问题描述
第二次在page_load上获取数据导致错误....
表示第一次从其他页面获取数据时的第一次正确获取.
代码是:-公共局部类UpdatePage:System.Web.UI.Page
{
字符串sEcode =";
字符串semployeename =";
字符串sdepartment =";
字符串slocation =";
字符串sdeptcode =";
受保护的void Page_Load(对象发送者,EventArgs e)
{
库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 =雇员姓名;
txtdepartment.Text = sdepartment;
txtlocation.Text = slocation;
}
但是在第二次从其他页面获取数据时,它给出了错误
像:-
公共局部类UpdatePage:System.Web.UI.Page
{
字符串sEcode =";
字符串semployeename =";
字符串sdepartment =";
字符串slocation =";
字符串sdeptcode =";
受保护的void Page_Load(对象发送者,EventArgs e)
{
库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 =雇员姓名;
txtdepartment.Text = sdepartment;
txtlocation.Text = slocation;
下面两行第二次读取数据.
我可以在以下两行中写以下内容:
还是我不得不做别的事情.
错误消息是:-对象引用未设置为对象的实例.
sdeptcode = Request.QueryString ["co"].ToString();
txtDeptcode.Text = sdeptcode;
}
请有人帮我第二次重载时如何编写以获取数据....
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....
推荐答案
这篇关于数据第二次在page_load上获取错误...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!