value in textbox in ascx from aspx

M

Murphy

How can I obtain the value of a text box in an usercontrol from the aspx
page ?

I'm using VB and WebMatrix and am presently learning asp.net whilst
struggling with the OO concepts...

Thanks

Murphy
 
A

Ashish M Bhonkiya

Expose method/property of the usercontrol to and use it from the aspx page.

Example:

Code in myusercontrol.ascx.cs

public string GetValueofTextBoxInUserControl()
{
return textBox1.Text.ToString();
}


Code in the aspx page.

string valuefromusercontroltextbox =
usercontrolinstance.GetValueofTextBoxInUserControl);

HTH
Regards
Ashish M Bhonkiya
 
M

Murphy

Thanks Askish,

Using Webmatrix I don't believe there is a code behind options so all code
must be between <script> and </script> tags...
If possible could you translate your code into vb so that I can eliminate
translation errors...

Thanks for your assistance

Murphy
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top