Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
how to fire the checked changed event for all the checkboxes which r created dynamiclly an a aspx page
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Pramod Kumar Nandagiri
14y
6.6k
1
Reply
hi i created one check box dynamically and added to table like bellow
CheckBox chk=new CheckBox();
chk.AutoPostBack = true;
chk.CheckedChanged += new EventHandler(chk_CheckedChanged);
tbcell3.Controls.Add(chk);
tbrow1.Cells.Add(tbcell3);
tbl.Controls.Add(tbrow1);
this.Controls.Add(tbl);
like this the check box was created dynamically now i want to write the code in chk_checkedchanged event,i tried with the bellow code it's working fine
void chk_CheckedChanged(object sender, EventArgs e)
{
tbl.BackColor = Color.Black;
}
if if kept the above code in for loop like bellow
for(int i=0;i<3;i++)
{
hi i created one check box dynamically and added to table like bellow
CheckBox chk=new CheckBox();
chk.AutoPostBack = true;
chk.CheckedChanged += new EventHandler(chk_CheckedChanged);
tbcell3.Controls.Add(chk);
tbrow1.Cells.Add(tbcell3);
tbl.Controls.Add(tbrow1);
this.Controls.Add(tbl);
}
Then on the form 3 check box controls will be created , and the checked changed event was working for the last check box, but i want the checked changed event should work for every check box wich is created dynamically with the above code
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
page navigation from address bar
how to validate a listbox is empty or with data