
asp.net(C#)从一个页面的Gridview的每一列的值传到另一个页面的Gridview
第一个页面:aspx:<asp:GridViewID="GridView2"runat="server"AutoGenerateColumns="False"Width=...
第一个页面:
aspx:
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" Width="1000px">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="Label10" runat="server" Text='<%# Eval("J_title") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
.cs:
protected void bind_judge() //判断题bind
{
DbHelper db = new DbHelper();
string sqltxt = "select top 4 * from tb_judge order by newid() ";
DataSet ds = db.GetDs(sqltxt);
GridView2.DataSource = ds;
GridView2.DataBind();
}
第二个页面里的Gridview要用里面J_title列的值。
怎么办呢? 展开
aspx:
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" Width="1000px">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="Label10" runat="server" Text='<%# Eval("J_title") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
.cs:
protected void bind_judge() //判断题bind
{
DbHelper db = new DbHelper();
string sqltxt = "select top 4 * from tb_judge order by newid() ";
DataSet ds = db.GetDs(sqltxt);
GridView2.DataSource = ds;
GridView2.DataBind();
}
第二个页面里的Gridview要用里面J_title列的值。
怎么办呢? 展开
2010-03-03
展开全部
其实有很多种方面,比如页面参数传递,用session
例如:
写入SESSION
Session("myvalue")="值"
读取SESSION
Label.Text = Session("myvalue")
,或者用this.Response.Redirect()来获取也可以;
例如:
this.Response.Redirect("index.aspx?labelvalue=值");
在index.aspx中,Label.Text = this.Request.Params["labelvalue"].ToString();
希望能够帮助到你。
例如:
写入SESSION
Session("myvalue")="值"
读取SESSION
Label.Text = Session("myvalue")
,或者用this.Response.Redirect()来获取也可以;
例如:
this.Response.Redirect("index.aspx?labelvalue=值");
在index.aspx中,Label.Text = this.Request.Params["labelvalue"].ToString();
希望能够帮助到你。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
在第一个页面 先得到Gridview要用里面J_title列的值
把它作为一个参数传过去就行了
把它作为一个参数传过去就行了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
String strOne = GridView2.Rows[e.RowIndex].Cells[对应列].Text.Trim();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询