Click here to Skip to main content
15,896,207 members
Articles / Web Development / ASP.NET

how to get textbox value of user control

Rate me:
Please Sign up or sign in to vote.
1.00/5 (1 vote)
7 Nov 2012CPOL 0  
In C# WINDOWSFirst go to user control,then for all textbox change access specifier private to public, if u r accessing them through another form or control,if not then no need to do public.then string...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
7 Nov 2012Rahul Rajat Singh
The best way to do that would be to create a property for each text box inside the user control as:public string TextBox1Value{ get { return textbox1.text; }}and from your page you can directly do:usercontrol1.TextBox1Value;this will contain the textbox value.
Please Sign up or sign in to vote.
7 Nov 2012Mohd. Mukhtar
Hi,Create property of the textbox expose them and then access form the calling page.Hope this help you.
Please Sign up or sign in to vote.
7 Nov 2012Member 8393790 4 alternatives  
I added the user control dynamically in asp.net(which contain 3 textboxes) using Jquery,how to get textbox value of user control in aspx.cs file. After dynamically show the user control page in aspx page, I have a button in aspx page when I click the button I need to get the value of...
Please Sign up or sign in to vote.
7 Nov 2012Sergey Alexandrovich Kryukov
What's wrong with System.Web.UI.WebControls.TextBox.Text? Please see:http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.aspx[^],http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.text.aspx[^].—SA

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Cognizant
India India
Interests:

My passion to solve business logic, with sql server scripting only without use of c# coding.
I love destructive programs & applications and coding in a very complex way.

Comments and Discussions