How to Use a Checkbox in Asp.Net 2.0
The ASP.NET 2.0 CheckBox control lets you give users several answers to choose when they submit a form. You can process the page when the user checks a box or wait until the user clicks a "Submit" button. You must first create the control on the ASP.NET Web form, then process your code in the "code-behind" files for the Web form.
Instructions
-
-
1
Click the Windows "Start" button and select "All Programs." Click "Microsoft .NET Framework," then click "Visual Studio." Open your Web project after the software loads.
-
2
Double-click the Web form in Solution Explorer to load the form. Drag and drop a "CheckBox" control from the toolbox to the Web form. Visual Studio draws the check box on the form. Drag and drop as many check boxes as you want to use on your form.
-
-
3
Click the check boxes to activate the control and display the control's property panel. Select "True" in the "AutoPostBack" property if you want to process the input from the user when the user checks the box. This means that when the user checks the box, you can process data without waiting for any other form input.
-
4
Double-click the check boxes to load the code in the ASP editor. You write the code for the check box processing in the window. For instance, the following code displays the checked box to the user:
Response.Write ("You chose " + checkbox1.Checked.Text);
-
1