Groups | Blog | Home
all groups > asp.net building controls > april 2004 >

asp.net building controls : value in textbox in ascx from aspx


Ashish M Bhonkiya
4/22/2004 3:36:41 PM
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

[quoted text, click to view]

Murphy
4/22/2004 4:11:22 PM
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

Murphy
4/22/2004 8:19:13 PM
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

[quoted text, click to view]

AddThis Social Bookmark Button