Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Through ajax call am calling GetBlinkStatus(startdate,enddate) at page load,

JavaScript
function getBlink(){
    var strtDate = document.newGetElementById('hidStrtDate').value;
    var endDate = document.newGetElementById('hidEndDate').value;
     Application_Home_Admin.GetBlinkStatus(strtDate, endDate , getData_callback); //Ajax call, Need to pass Schedule date from dropdownlist
    }

Server side code, changing hidden value on drop down change

C#
if (index == 0)
            {
                fromDate = DateTime.Now.ToString(CommonSessions.CorporateDateFormat);
                toDate = DateTime.Now.ToString(CommonSessions.CorporateDateFormat);
                lblCurrentFilter.Text = GetResourceValue(ResourceFiles.DefaultLocal, "Scheduleson") + " " + GetFormattedDate(DateTime.Now);
                //GetBlinkStatus(DateTime.Now,DateTime.Now);
               <code> hidStrtDate.Value = Convert.ToString(DateTime.Now);
                hidEndDate.Value = Convert.ToString(DateTime.Now);</code>
            }
            else if (index == 1)
            {
                fromDate = currentFirstDay.ToString(CommonSessions.CorporateDateFormat);
                toDate = endDate.ToString(CommonSessions.CorporateDateFormat);
                lblCurrentFilter.Text = GetResourceValue(ResourceFiles.DefaultLocal, "Schedulesfrom") + " " + GetFormattedDate(currentFirstDay) + " " + GetResourceValue(ResourceFiles.Default, "To") + " " + GetFormattedDate(endDate);
                //GetBlinkStatus(currentFirstDay, endDate);
                <code>hidStrtDate.Value = Convert.ToString(currentFirstDay);
                hidEndDate.Value = Convert.ToString(endDate);</code>
            }


Ajax method in server side

C#
[AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.Read)]
    public int GetBlinkStatus(string strtDate,string endDate)
    {
        int returnVal = -1;
        returnVal = Obj.GetBlinkStatusByDate(Convert.ToDateTime(strtDate), Convert.ToDateTime(endDate));
        return returnVal;
    }



Initially am passing parameters from Hidden field, so no problem in it.
But when I change hidden field value in server side, older values still persist and passed as parameter to the ajax call.

How can I overcome this issue?
Any helps will be greatly appreciated.

Regards,
RK
Posted
Updated 16-Dec-13 2:51am
v3

1 solution

Friends,

I called client side function in server side once hidden value is assigned.
Now its working as expected.

Regards,
RK
 
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