|
I have a simple web form that sends user inputs via email, then pops up a page and shows all the input values submitted from the form. With the codes I have for the Checkboxlist, ID is CblCerts, it would only display the ONE/first selected values.
...
PrintBody +="Private Line: " + PhonePrivateLine.Text + "<br>";
PrintBody +="Mobile: " + PhoneMobile.Text + "<br>";
PrintBody +="Fax: " + Fax.Text + "<br>";
PrintBody +="Certifications: " + CblCerts.SelectedValue + "<br>";
PrintBody +="Multilingual: " + Languages.Text + "<br>";
...
How can I get it to show both values if selected on the pop-up window?
Here's my cbl control:
<asp:CheckBoxList ID="CblCerts" runat="server" CssClass="bodytext">
<asp:ListItem value="Notary" id="option1" runat="server">Notary</asp:ListItem>
<asp:ListItem value="Medallion" id="option2" runat="server">Medallion</asp:ListItem>
</asp:CheckBoxList>
Function to send email:
void Submit_OnClick(object sender, EventArgs e)
{
if(Page.IsValid)
{
SendEmail();
}
}
This is what I have within the SendEmail() function:
TextBody +="Certifications: " + "\r\n";
if(CblCerts.SelectedIndex != -1)
{
for (int i=0; i<CblCerts.Items.Count; i++)
{
if (CblCerts.Items.Selected)
{
TextBody += "* " + CblCerts.Items.Text + "\r\n";
}
}
}
|
|
|
|
|
|
|
// |