How Do I Get Text Of Label When Changed To Server Side?
Solution 1:
You are not going to get the value of the <asp:Label
you modified on client side at the code behind. If I'm correct ASP.NET label is rendered as a span element in the client side:
I think that only the controls that are rendered as input controls and values changed at client side are updated on viewstate, so your only resort is to stick to the hidden field.
You just have to do the other way around.
1.Pass the hidden field to the js function and update the value of the hidden field at the client side in your js function PayPeriodsPayroll
like below
functionPayPeriodsPayroll (hdnObj)
{
var hdnPayPeriod = document.getElementById(hdnObj);
hdnPayPeriod.val('the value you want to set');
}
Then in your pageload
If Not IsPostBack Then
....
Else// update label with the hidden field value if you need it
lblPayPeriodStartDt.Text = hdnPayPeriodStartDt.Value
End If
Solution 2:
surely you are not posting back to the server every time you change the date in the calendar control.
You can do a postback to the server from javascript using the __doPostback() function.
see this link:
__doPostback function example
Post a Comment for "How Do I Get Text Of Label When Changed To Server Side?"