asp.net - Data transfer between pages -


protected void page_load(object sender, eventargs e)   {       label1.text=request.querystring["fileno"].tostring();         label3.text=request.querystring["sub"].tostring();       ddl_u.selectedvalue=request.querystring["unit"].tostring();     ddl_branch.selectedvalue=request.querystring["branch"].tostring(); } 

this pageload function of file.aspx page. getting error on querystring when debug file.aspx

i have 2 pages named file.aspx , search.aspx. want transfer data search.aspx file.aspx. using querystring transfer data , initialising data controls on pageload function of file.aspx problem file.aspx start page giving error on querystring.

so need take care of query string when not available or null. write code inside this

protected void page_load(object sender, eventargs e) {   if (request.querystring["fileno"] != null)   {     label1.text = request.querystring["fileno"].tostring();   }   if (request.querystring["sub"] != null)   {     label3.text = request.querystring["sub"].tostring();   }   if (request.querystring["unit"] != null)   {     ddl_u.selectedvalue = request.querystring["unit"].tostring();   }   if (request.querystring["branch"] != null)   {     ddl_branch.selectedvalue=request.querystring["branch"].tostring();   } } 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -