Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic webcontrols in asp.net 2.0

Status
Not open for further replies.

NickMalloy

Programmer
Apr 15, 2005
68
US
How do you get data from dynamically created textboxes that are in a placeholder that resides in a content page controled by a master page. I recreate the textbox everytime the page loads. I used this same code in 1.1 and it worked fine, now it isn't.

Here is two ways I have tried
<code>
Dim a As TextBox
a = CType(Me.Page.FindControl("first12"), TextBox)

Dim mpContentPlaceHolder As ContentPlaceHolder
Dim mpTextBox As TextBox
mpContentPlaceHolder = _
CType(Master.FindControl("cp"), _
ContentPlaceHolder)
If Not mpContentPlaceHolder Is Nothing Then
mpTextBox = CType(mpContentPlaceHolder.Page.FindControl("first12"), _
TextBox)
If Not mpTextBox Is Nothing Then
mpTextBox.Text = "TextBox found!"
Else
Response.Write("Not Fount")
End If
End If
</code>
 
in which event is this placed? the Page_Load???

Known is handfull, Unknown is worldfull
 
That code is found in the btn click sub. The page load is where the controls are created.
 
Do you have an example. I did this and it didn't work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top