Hi Pals,
I have one new requirement which i had not done so far.The Requirement is "I need to save the page entire data for every five minutes without a postback".
The page can contains the Nested Grid views and some complex data container controls. The Approach that i am following is using the XMLHttpRequestobject, i am positing the Data back to the server. before posting the data back to the sever, i am Generating the Data to be posted back as below.
var theData = '';
var theform = document.forms[0];
var thePage = window.location.pathname + window.location.search +'?isCallBack='+queryString;
var eName = '';
if(eventTarget)
theData = '__EVENTTARGET=' + escape(eventTarget.split("$").join(":")) + '&';
theData += '__EVENTARGUMENT=' + eventArgument + '&';
theData += '__VIEWSTATE=' + escape(theform.__VIEWSTATE.value).replace(new RegExp('\\+', 'g'), '%2b') + '&';
theData += 'IsCallBack=true&';
for( var i=0; i<theform.elements.length; i++ )
{
eName = theform.elements[i].name;
if( eName == '__EVENTTARGET' || eName == '__EVENTARGUMENT' || eName == '__VIEWSTATE' ||eName == '__SCROLLPOSITIONX'||eName == '__SCROLLPOSITIONY'||eName == '__VIEWSTATEENCRYPTED')
{
// Do Nothing
}
else if(eName == '__EVENTVALIDATION')
{
theData += '__EVENTVALIDATION=' + escape(theform.__EVENTVALIDATION.value.split("$").join(":")).replace(new RegExp('\\+', 'g'), '%2b') + '&';
}
else
{
if(theform.elements[i].type.toString()=="checkbox")
{
if(theform.elements[i].checked)
{
theData = theData + escape(eName.split("$").join(":")) + '=checked';
}
else
{
theData = theData + escape(eName.split("$").join(":")) + '=';
}
theData = theData + '&';
}
else
{
theData = theData + escape(eName.split("$").join(":")) + '=' + theform.elements[i].value;
theData = theData + '&';
}
}
}
theData+='__SCROLLPOSITIONX=0&';
theData+='__SCROLLPOSITIONY=244&';
theData+='__VIEWSTATEENCRYPTED= &';
Once that is completed i am posting the data to the server as below.
if(this.XmlHttp)
{
if( this.XmlHttp.readyState == 4 || this.XmlHttp.readyState == 0 )
{
var oThis = this;
this.XmlHttp.open('POST', thePage, true);
this.XmlHttp.onreadystatechange = function()
{ oThis.ReadyStateChange(); };
this.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
this.XmlHttp.send(theData);
}
}
This will Asynchronously call the Page_Load event. There i am able to get all the modified data of controls.But i had the Nested Grid View in the page, Inthe inner grid view , i had a check box. i am not able to find the control value.
can any one please help me out in solving this.