checkBoxList control email results

May 13 2008 1:55 PM
I have a form (http://www.readwritenow.org/pages/vo...ntakeForm.aspx) the results of which need to be e-mailed.

The checkBoxList control is populated manually, there is no database involved. In the interest of your time, I have removed the textBoxes and dropDownLists from the .cs below since they behave perfectly.

The problem I am having is the checkBoxList control is returning only the first checked selected item, not all items selected.

I'm a newbe and in over my head, so please treat your response accordingly.

Thanks for your help!

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Net.Mail;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class pages_volunteerIntakeForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void sendButton_Click(object sender, EventArgs e)
{
successLabel.Text = "Thanks for your interest, " + firstNameTextBox.Text + ". Your information has been sent, and we'll be contacting you soon!";
MailMessage message = new MailMessage();
message.From = new MailAddress("[email protected]");
message.To.Add(new MailAddress("[email protected]"));
message.Subject = "Volunteers Intake Form";
message.IsBodyHtml = true;
message.Body = "<h2 style='color:red;'>Volunteer Intake Form</h2>"
+"<Strong>Preferences</strong><br />"
+ "Would like to tutor at:&nbsp;&nbsp;" + tutorAtCheckBoxList.Text + "<br />"
+ "Days and times available:&nbsp;&nbsp;" + timesAvailableCheckBoxList.Text + "<br />"
+ "Interested in working with:&nbsp;&nbsp;" + workChoicesCheckBoxList.Text + "<br />"
+ "Can help in other areas:&nbsp;&nbsp;" + alsoHelpCheckBoxList.Text + "<br />"
+ "Learner preference:&nbsp;&nbsp;" + learnerPreferenceDropDownList.Text + "<br /><br />" + "Skills, experience and backgroundbr />"
+ commentsTextBox.Text;
SmtpClient client = new SmtpClient();
client.Send(message);
}
}
locoLindy is online now Report Post  

Answers (3)