The above one you can do it in 2 ways:
1. Create a hidden field and bind the value to it using Jquery and access that in C#.
2. The Second Method is simply adding a Read Only attribute to the Text Box
in the Code behind during !IsPostback in the page Load Event.
See the Example:--
In the aspx file:
In the Code behind(C#):
1. Create a hidden field and bind the value to it using Jquery and access that in C#.
2. The Second Method is simply adding a Read Only attribute to the Text Box
in the Code behind during !IsPostback in the page Load Event.
See the Example:--
In the aspx file:
<asp:TextBox ID="txtCheckin" runat="server"></asp:TextBox>
In the Code behind(C#):
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack) { txtCheckin.Attributes.Add("readonly", "readonly");
}
}
Now you can access the value of the txtCheckin with ReadOnly.
Note: Don't Write ReadOnly="True" in the asp:TextBox Tag.
No comments:
Post a Comment