Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 27th, 2007, 03:47 AM
Authorized User
 
Join Date: Jul 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default checkbox selection in a webform

hi, i am new to asp.net and using c# for code behind
if i want to select checkbox from a checkbox list how can i do this in c#. i am assuming that i can select more than one check box.

 
Old July 27th, 2007, 05:52 AM
Authorized User
 
Join Date: May 2007
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to DarkForce
Default

you can simply select a checkbox by clicking on it, but as i assume that you don't want just this but also save your results so you can do something with them i copied this small example

foreach (ListItem item1 in CheckBoxList1.Items)
        {
            if (item1.Selected)
                Session["CheckBoxList1"] += item1.Value;
  }

because every item is either selected or not, you can check this with a for each loop.
if one of the items is selected you can save the result, like in this case in a session variable, in a variable.


Ivan





Similar Threads
Thread Thread Starter Forum Replies Last Post
Disabling Selection Of CheckBox pady123 Pro Visual Basic 2005 1 April 8th, 2008 05:16 AM
Disable checkbox until a selection is made DrConners Access VBA 3 January 12th, 2008 01:07 AM
Multi Checkbox selection - ASP cancer10 Classic ASP Databases 7 November 21st, 2006 01:00 AM
inserting multiple selection from checkbox in to o [email protected] Pro JSP 0 March 30th, 2006 12:04 AM
Excel Checkbox selection thru C# imsuneeta General .NET 1 June 16th, 2005 02:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.