protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "安排")
{
Session["Ship_id"] = e.CommandArgument;
Session["Ship_Item_style"] = GridView1.SelectedRow.Cells[1].Text;
Session["Ship_Goal_harbour"] = GridView1.SelectedRow.Cells[5].Text;
Response.Redirect("~/Ship_decide_2.aspx");
}
}我运行后点击gridview的安排之后提示
Session["Ship_Item_style"] =GridView1.SelectedRow.Cells[1].Text; 这行未将对象引用设置到对象的实例,但是我网页里有个GridView1了,还要初始化什么吗?
{
if (e.CommandName == "安排")
{
Session["Ship_id"] = e.CommandArgument;
Session["Ship_Item_style"] = GridView1.SelectedRow.Cells[1].Text;
Session["Ship_Goal_harbour"] = GridView1.SelectedRow.Cells[5].Text;
Response.Redirect("~/Ship_decide_2.aspx");
}
}我运行后点击gridview的安排之后提示
Session["Ship_Item_style"] =GridView1.SelectedRow.Cells[1].Text; 这行未将对象引用设置到对象的实例,但是我网页里有个GridView1了,还要初始化什么吗?
解决方案 »
- windows 2008 server中系统部署异常
- ==网页能实现复制粘贴功能吗==
- Datalist
- 怎么样循环删除dataset里的符合要求的记录
- 关于页面中Table导入到Excel的问题
- 当checkbox为true时,textbox的enable为ture;反之,textbox的enable为false
- asp.net里面的WEB.Config可以通过文件来读写吗
- 求救有关HttpWebRequest、HttpWebResponse使用的疑问。
- ASP.NET求救
- asp.net登录实现
- 一个关于权限设置问题! 求思路!!
- onclientclick返回false仍执行GridView1_RowCommand问题
Ship_id Item_style Max_weight Now_weight Now_harbour Goal_harbour
bh22222222 集装箱 2000 1200 beihai qinzhou 查看货物 安排我运行后的画面大概是这样,“查看货物”是gridview原来的“选择”,“安排”是我编辑模板加的linkbutton,如果先点“查看货物”再按“安排”是正常的,但是如果我先按“安排”就提示出错了。怎么回事呢?
bh22222222 集装箱 2000 1200 beihai qinzhou 查看货物 安排
我的数据是这样的,按理说cells[1]应该是“集装箱”呀,不是空的呀。