Page.FindControl() returns null when searching for dynamic control

后端 未结 1 701
终归单人心
终归单人心 2021-01-21 00:15

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 f

相关标签:
1条回答
  • 2021-01-21 01:11

    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

    0 讨论(0)
提交回复
热议问题