[RESOLVED] How to find a dynamically built control in asp.net web page

In my one asp.net web page by VS 2008 I dynamically creates a set of RadioButtonList and TextBox by objects

Dim

rdoList As RadioButtonList = New RadioButtonList() with rdoList.ID = "rdoTask" & ID

Dim

 

txtComment As TextBox = New TextBox() with  txtComment.ID = "txtComment" & ID

 ID depending on DataRow count number and add these objects to TableCell which is added to TableRow which is added to

<

 

asp:Table ID="tblTaskStandards" runat="server"> set on the aspx file.

The current issue is I can load the web page with a set of RadioButtonLists and TextBoxs but can't find the these dynamically built controls by Me.FindControl("rdoTask" & ID) in aspx.vb file to save info assigned to these controls.

How to solve this issue ? Thanks a lot in advance!



 

Re-create the controls (using the same original ID) on EVERY postback, and you shouldbe able to use findcontrol() after that.

Thank you for the message. In order to post back, what shouls I do in the code?

A postback occurs usually as a result of some event taking place on the page like a button click, or a slection from a dropdownlist, or text changed in a textbox.  So you must have something on your form that's raising an event like a button click for instance; that's going to cause a postback.

thoughts on "[RESOLVED] How to find a dynamically built control in asp.net web page "

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>