如何将gridview行的总数计数值传递到其他.aspx页面 [英] How to pass the total number of gridview rows count value into other .aspx page
问题描述
Hai,
我正在使用gridview.It有20行。我想将计数值传递给下一行。 aspx页面。我怎么能这样做。通过使用会话就可以了吗?我试过使用session.But它没有填充值。
源页面:< br $>
Hai,
I am using gridview.It is having 20 rows.I want to pass the count value into next .aspx page.How can i do this.By using session it is ok?I tried by using session.But it is not populating the value.
Source page:
Session["Incidentgv"] = grdEmployee.Rows.Count.ToString();
目标页面:
Target page:
string incident=(string) Session["Incidentgv"];
Plz帮助我。
提前致谢
Plz help me.
Thanks in advance
推荐答案
获取行数u可以使用
grdEmployee.Rows.Count;
为了将此值传递到下一页,您可以使用查询字符串如下
For passing this value to next page u can use query string as follows
Response.Redirect("page2.aspx?Count=value");
您可以在第2页检索此值为
U can retrieve this value at page 2 as
String value = Request.QueryString["Count"]
string incident = Session [Incidentgv]。ToString();
string incident = Session["Incidentgv"].ToString();
在此代码行之前检查session是否为空或
Before this line of code check if session is null or empty
if(session["Incidentgv"]!=null)
{//If session doesn't contain any value then controll will not enter here.
string incident=(string) Session["Incidentgv"];
}
如果session为null,那么你可以将其设置为null其他地方......
If session is null then you may making it null some where else...
这篇关于如何将gridview行的总数计数值传递到其他.aspx页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!