简体   繁体   中英

pass html TextBox Value from User control to aspx page

I am creating a user control where in i have different HTML text boxes and for items like name profession contact etc. i have a edit and save button for each item. so when i click on the save button i want the value of that text box and update the same in the database . So for this i want to send that value to the ASPX page. but i don't know how to send that value to the ASPX.Also if there is another way to achieve this them please suggest.I am using the three tier architecture.

Thankx

If text box is asp text box or html runat="server" st than you need to expose textbox value as property

public string textData
{
 get { return mytextbox.Text; }
 set { mytextbox.Text = value; }
}

OR

If you text box is html than make use of Request.QueryString["textboxnameorid"] will provide you data on postback.

if you are using asp.net textbox, you can create public properties in you usercontrol like this

public string Name
        {
            get { return tbName.Text; }
            set { tbName.Text = value; }
        }

and this public property can be get set in asp.net page easily..

Regards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM