Click here to Skip to main content
15,922,407 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
Hello,

I'm trying to assign the text of a label to a hidden field when not post back but I fail. This is what I done.

VB
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

Problem comes in else clause where the value doesn't get update with new label value. lblPayPeriodStartDt.Text is not updating.

The value of label is date and it updates every time I change the date using calender control on client side. But, the value of the label doesn't refresh with that value.


<img src="../Images/calendar.gif" class="clsCursorHand" alt="" title="Select Pay Period"
                             önclick="Javascript:PayPeriodsPayroll('<%=lblPayPeriodStartDt.ClientId %>',event);"/>
Posted
Updated 18-Jul-14 10:38am
v3

Try you to assign the text of a label in the Calendar Control SelectionChanged event
 
Share this answer
 
v3
Comments
Member 10499955 18-Jul-14 16:40pm    
actually this is not a calender control, it is just a calender image which on click triggers a java script function to display weekend dates and update label with that date when a weekend date is selected. I have included that now in code, please check.
I just passed the value of hidden field instead of label in JS function, and assigned that value to label..thanks for all your responses.

önclick="Javascript:PayPeriodsPayroll('<%=hdnPayPeriodStartDt.ClientId %>',event);"/>
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900