3

In asp.net web form-I have added group of radio button dynamically in web form and on clicking submit button when i try to the find the radio button button with its id using find.control(id), it returns null. Can some body help me am new to asp.net?

RadioButton myControl1 = (RadioButton)Page.FindControl("r11");

1 Answer 1

4

Two reasons.

When you add controls dynamically, you must re-add them when the page posts back (In Page_Init is a good place). See How to persist a dynamic control

The other is that Page.FindControl() only goes one level down, you need to recursively search down the list. See Better way to find control in ASP.NET

1
  • In oder to re add them how do i know which checked boxes are checked?.My question is, dynamically added radio button is checked and on submit i couldn't find the control to get its check property. Feb 10, 2014 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.