Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
4
Reply
Visual Studio 2010 Form Checkbox value C#
Prasad Sam
Oct 28 2014 10:24 AM
738
Reply
I created a form page, I have several check boxes and and Text boxes on the form page. Checkboxes named like Group1,Group2,Group3,Group4, and Group5. textbox named as RErrors. I just want to show the value in textbox if check box is checked. (If 5 check box are checked then value will be 5, 3 checked means 3, show in text box.)
I tried to put the below code but nothing happens.
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
public
partial
class
Default2
: System.Web.UI.
Page
{
protected
void
Page_Load(
object
sender,
EventArgs
e)
{
int
sum = 0;
if
(Group1.Checked ==
true
) sum += 1;
if
(Group2.Checked ==
true
) sum += 1;
if
(Group3.Checked ==
true
) sum += 1;
if
(Group4.Checked ==
true
) sum += 1;
if
(Group5.Checked ==
true
) sum += 1;
//return sum RErrors
}
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
help_please
web site deploy on internet