c# - Get the value from Request.QueryString into another method -


i trying value of nom studentlistbyfilter(), can me these? default value returned 0. want insert query string(nom) studentattendancelist() value 0.

public partial class attedancemanagementjt : system.web.ui.page {     protected void page_load(object sender, eventargs e)     {         //int nom = convert.toint32(request.querystring["activityid"]);     }     [webmethod(enablesession = true)]     public static object studentlistbyfilter()     {         return applymethods.studentattendancelist(convert.toint32(httpcontext.current.request.querystring["activityid"]));     } 

the reason can't "pass" value other method isn't method. it's "page method", operates in separate request. in second request, there no "activityid" query string parameter.

however, can pass query string parameter first request, through session state, second request:

public partial class attedancemanagementjt : system.web.ui.page {     protected void page_load(object sender, eventargs e)     {         int nom = convert.toint32(request.querystring["activityid"]);         session["nom"] = nom;     }      [webmethod(enablesession = true)]     public static object studentlistbyfilter()     {         return applymethods.studentattendancelist(             convert.toint32(httpcontext.current.session["nom"]));     } } 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -