I would like to allow the user to check off "who" to send e-mails to (see attached image) and then open their mail with all those usernames in the To: line. I'm looking to allow them to check more then 1 check box - having all the names appear.
How can I do that.
*** Read the sticky in the DB forum about how to get your question answered quickly!! ***
Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".
When you say "and then open their mail", do you mean their email client?
If yes, then it's a liiiitle bit complicated.
So the user checks a bunch of checkboxes, clicks on a button and you want this to happen. In the button's click event, go through each row where the checkbox is checked. Find the corresponding email address. Then, concatenate a string and your eventual aim is to do this
Hmm... do you want to avoid javascript? Because I know this is an 'internal' application for your company, you can take certain liberties such as assuming the user has javascript turned on, uses IE/Firefox, compatible browsers, all that business.
Yes, javascript is what enables postbacks but I believe that if you disable javascript, the browser attempts to 'gracefully' degrade to use form submissions with extra information.
The codebehind way, in which you loop through your repeater, get all the email addresses, concatenate it and do the response.redirect, would actually be easier.
If you did it in javascript, you will need to have a hidden field in each row of your repeater that contains the corresponding email address. When the checkbox is checked, you can have each checkbox manipulate a global javascript variable (array), adding or removing its value from that array. The array is obviously important, since you will use that array - loop through it, read each element, concatenate the string.
A Response.Redirect isn't going to work. The redirect process starts on the server side and thus, you'll end up on a page with just the mailto stuff in it.
The only way to make the client mail application open is via a client side event on the page (a click of a link, if you will).
I don't think there is anyway to do this entirely on the server side. Take the frog's code, put your name on it and use that
Edit: Unless I'm missing something and there is a header you can add to your redirect that could make this work...
Edit 2: I wonder if it's possible to modify the headers when the response is being sent with something like this:
Edit 3: Another option is to register some JavaScript to run onLoad and have it automatically open Url with mailto in the address.
So in your OnInit method, register a JavaScript that you modify to include the appropriate Url. When the page returns on that postback, Bam! E-mail pops open.
Last edited by Kasracer; Aug 20th, 2008 at 12:18 PM.
KrisSiegel.com - My Personal Website with my blog and portfolio Don't Forget to Rate Posts!
Perhaps mailto hasn't been registered for you, although it's been years since I've done this I thought mailto would open up the email client on the user's desktop.
We click on the Email Selected spot and it runs re-direct.
The re-direct sends the browser to an empty page with the MAILTO: in the address bar.
The CLIENT E-MAIL app does open - that's working great.
But the browser has to be back-buttoned to the page we were just on.
We tried make the EMAIL SELECTED be a MAILTO: link - that grows as each person to e-mail is clicked. But the page posts back and there is a noticeable flash - that stinks.
Last edited by szlamany; Aug 22nd, 2008 at 11:56 AM.
*** Read the sticky in the DB forum about how to get your question answered quickly!! ***
Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".