.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

How to get Multiple Selected item values from a ChekboxList

Posted By:Syed Shakeer Hussain       Posted Date: May 08, 2009    Points: 10    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  
 

1)first drag and drop a CheckBoxList on your webPage.
2)Add Some Items.
3)Drag and drop one Button.

After selecting Your items from Checkboxlist, Click on Button to get values or text selected by you.


protected void Submit_Click(object sender, EventArgs e)
{
   String str=null ;
  for (int i = 0; i < CheckBoxList1.Items.Count ; i++)
 {
      if (CheckBoxList1.Items
.Selected == true)
     {
        Response.Write (str = CheckBoxList1 .Items
.Text .ToString ()+"
");

      }
   }
}


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend