codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Unable to display ALL selections from Checkboxlist  novasian at 03:38 on Tuesday, May 12, 2009
 

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";
}
}
}










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Creating a file in a different directory...
•  Auto Populating Lists
•  Unable to display ALL selections from Checkboxlist
•  dropdown list for country,state and city
•  split file column wise
•  Need Javascript Multiple sidebar menu with sliding effects
•  Re: how to create forum using asp.net with c# language?
•  creating user defined service
•  Re: Help with Form--onClick won`t run function


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2009