Click here to Skip to main content
16,015,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
data fetch second time on page_load giving error....
means first time when i am fetching data from other page its properly fetched.
code is:-public partial class UpdatePage : System.Web.UI.Page
{

string sEcode = "";
string semployeename = "";
string sdepartment = "";
string slocation = "";
string sdeptcode = "";
protected void Page_Load(object sender, EventArgs e)
{

Library lib = new Library();
sEcode = Request.QueryString["cc"].ToString();
semployeename = Request.QueryString["cd"].ToString();
sdepartment = Request.QueryString["ce"].ToString();
slocation = Request.QueryString["cf"].ToString();


txtempcode.Text = sEcode;
txtEmployeename.Text = semployeename;
txtdepartment.Text = sdepartment;
txtlocation.Text = slocation;



}
but while second time fetching data from other page its giving error
like :-
public partial class UpdatePage : System.Web.UI.Page
{

string sEcode = "";
string semployeename = "";
string sdepartment = "";
string slocation = "";
string sdeptcode = "";
protected void Page_Load(object sender, EventArgs e)
{

Library lib = new Library();
sEcode = Request.QueryString["cc"].ToString();
semployeename = Request.QueryString["cd"].ToString();
sdepartment = Request.QueryString["ce"].ToString();
slocation = Request.QueryString["cf"].ToString();


txtempcode.Text = sEcode;
txtEmployeename.Text = semployeename;
txtdepartment.Text = sdepartment;
txtlocation.Text = slocation;

below two line fetching data second time.
Below two lines shall i can write in this block
or i have to some thing else.

error msg is :-Object reference not set to an instance of an object.
sdeptcode = Request.QueryString["co"].ToString();
txtDeptcode.Text = sdeptcode;
}


please someone help me how to write for fetching data while reload second time....
Posted
Updated 20-May-10 4:48am
v2

1 solution

Why do you need to reload it at all ? Is your query string still present when you refresh ? Did you consider that telling us the error message and line of the error might help us tell you what is wrong ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900