PDA

View Full Version : C# Email Form - Multiple listbox selections


jv_web
08-04-2010, 01:12 AM
Hello,

Im trying to generate an email with Multiple Listbox selections... Unfortunately the listbox allows me to select multiple choice but when I submit the form only one "selection" is shown... Im assuming a for each or something will be needed here... all tests using that method have failed. Could someone point me in the right direct or show me?

[CODE]
<script runat="server">

void btnSubmit_Click(Object sender, EventArgs e) {

MailMessage objEmail = new MailMessage();
objEmail.To = txtTo.Text;
objEmail.From = txtFrom.Text;
objEmail.Subject = "Sample Form";
objEmail.Body = "<h2>Sample Form Title</h2>" + "<br />" + listType.SelectedItem.Text + "<br />";
objEmail.Priority = MailPriority.High;
objEmail.BodyFormat = MailFormat.Html;


try{
SmtpMail.Send(objEmail);
Response.Write("Email Sent - Thank You!");
}
catch (Exception exc){
Response.Write("Send failure: " + exc.ToString());
}
}
</script>
[CODE]

santhoshj400
08-04-2010, 02:24 PM
hi please go through the link

http://viralpatel.net/blogs/2009/06/listbox-select-all-move-left-right-up-down-javascript.html

jv_web
08-04-2010, 04:09 PM
Im sorry but Im looking for a all C# answer... appreciate it tho.