User control and aspx page

kaisersoze

Centurion
Joined
Aug 27, 2003
Messages
152
Hi
I have a user control and I am placing that user control on an .aspx page. How can I access the Textbox or label on the usercontrol without writing a property that returns the label or textbox. Is there a way like this:

dim v1 as string = ctype(me.parent.findcotrol("label1", Label).text

I am getting error
 
I'm having a hard time understanding what you are asking. Are you looking for something like this;

<script>
Dim strTextContent As String
strTextContent = txtTextBox.Text
lblRepeatText.Text = strTextContent
</script>

<form runat="server">
<asp:textbox id="txtTextBox" runat="server"/>
<asp:label id="lblRepeatText" runat="server"/>
</form>
 
I have usercontrol on an aspx page. The user control has few label controls and data is filled from database during Page_Load event of the .ascx usercontol. I called this user control on an .aspx page. During the Page_load event of the .aspx I am trying to access the label.text and text1.text values. Since the page load first and then the usercontrol I am not able to access the usercontrol variables. Is there a way I can load user control and then proceed with other contols.
 
Back
Top