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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -