I'm having difficulty assigning the text of a label to a hidden field when it's not a postback. Here is the code I have written:
If Not IsPostBack Then
Dim structPayperiod As strcPayperiodDet
structPayperiod = objTimeSystem.getCurrentPayPeriod()
hdnPayperiodseq.Value = structPayperiod.Payperiodid
hdnPayPeriodStartDt.Value = structPayperiod.startdate.ToString
lblPayPeriodStartDt.Text = structPayperiod.startdate
displayPayrollIdOrgs(objTimeSystem.getPayrollIDOrgs())
grd_Employees.Visible = False
RptErrorsMessages.DataSource = objTimeSystem.getErrorMessages()
RptErrorsMessages.DataBind()
Else
hdnPayPeriodStartDt.Value = lblPayPeriodStartDt.Text.ToString
End If
The issue arises in the else clause where the value does not update with the new label value. The lblPayPeriodStartDt.Text does not seem to be updating.
The label holds a date value that updates each time I change the date using a calendar control on the client side. However, the label value does not refresh with the updated date value.
<asp:Label ID="lblPayPeriodStartDt" runat="server"></asp:Label>
<img src="../Images/calendar.gif" class="clsCursorHand" alt="" title="Select Pay Period"
onclick="Javascript:PayPeriodsPayroll('<%=lblPayPeriodStartDt.ClientId %>',event);"/>