why viewstate,gridview is null inside static method

Posted by Oswaldlily under ASP.NET on 7/16/2013 | Points: 10 | Views : 3326 | Status : [Member] | Replies : 2
To call server side function from Javascript I used webmethod ,,..

Calling viewstate inside static function..

But viewstate is null... and gridview too




Responses

Posted by: Rimi1289 on: 7/16/2013 [Member] Starter | Points: 25

Up
0
Down
Use "Session" instead of "ViewState". Else a "Variable" can do the job.

To assign "Session" in your webmethod, add this line above the function in which the "Session" object will be declared.

<System.Web.Services.WebMethod(EnableSession:=True)> _



http://www.encodedna.com/2013/05/pass-multiple-para-to-webmethod.htm



Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Oswaldlily on: 7/16/2013 [Member] Starter | Points: 25

Up
0
Down
@rimi

Even my gridivew is null..How to access it

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response