Response.Redirect页面传值问题

言月秋 言月秋 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<asp:GridView ID="GridView1" runat="server" Visible="False" OnRowEditing="GridView_RowEditing" onselectedindexchanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:ButtonField CommandName="Edit" Text="详细" />
</Columns>
</asp:GridView>
gridview中绑定了 protected void GridView_RowEditing(object sender, GridViewEditEventArgs e)
{
this.GridView1.EditIndex = e.NewEditIndex;
int selectIndex = this.GridView1.EditIndex;
string louhao = this.GridView1.Rows[selectIndex].Cells[1].Text.ToString();
string qinshihao = this.GridView1.Rows[selectIndex].Cells[2].Text.ToString();
base.Response.Redirect("detailed.aspx?louhao =" + louhao + "&qinshihao=" + qinshihao + " " );

}
detailed.aspx中
string louhao = Server.UrlDecode(Request["louhao"]);
string qinshihao = Server.UrlDecode(Request["qinshihao"]);
Response.Write("<script>alert('" + louhao + "')</script>");
Response.Write("<script>alert('" + qinshihao + "')</script>");


if (!louhao.Trim().Equals("")) 这里报错未将对象引用设置到对象的实例。
{
louhao = " and louhao='" + louhao + "'";
}
else
{
louhao = "";
}
估计报错原因为未接受到上个页面传过来的值,所以判断时报错,大家看下我传值哪里写错了。
...全文
评论 8
收藏 已收藏
分享
返回顶部
言月秋
.NET社区 62,272 成员 668,968 内容