value in textbox in ascx from aspx

  • Thread starter Thread starter Murphy
  • Start date Start date
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
 
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
 
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
 
Back
Top