access user control' s control

  • Thread starter Thread starter js
  • Start date Start date
J

js

hi,
I have a user control, but I don't have source code, only have the aspx
file, I added one text (txtMyName) to it, how to access this textbox and get
the value form user input? Please advice, many thanks.
 
Hi,

you can run FindControl against the user control (using ID of the UC) on the
aspx page

Dim txtMyName As TextBox =
DirectCast(MyUserControl1.FindControl("txtMyName"), TextBox)

where "MyUserControl1" is ID of the user control on aspx page
 
Thanks Teemu ...


Teemu Keiski said:
Hi,

you can run FindControl against the user control (using ID of the UC) on
the aspx page

Dim txtMyName As TextBox =
DirectCast(MyUserControl1.FindControl("txtMyName"), TextBox)

where "MyUserControl1" is ID of the user control on aspx page

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
 
Thanks for the help,
Can I assign a value to it?

Teemu Keiski said:
Hi,

you can run FindControl against the user control (using ID of the UC) on
the aspx page

Dim txtMyName As TextBox =
DirectCast(MyUserControl1.FindControl("txtMyName"), TextBox)

where "MyUserControl1" is ID of the user control on aspx page

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top