protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
{
foreach (GridViewRow row in this.GridView1.Rows)
{
HyperLink link = (HyperLink)e.Row.Cells[4].Controls[0];
string Member_order_ID = link.Text.Trim();
if (e.Row.Cells[5].Text == "重复消费")
{
HyperLink hyl = (HyperLink)row.FindControl("EditID");
hyl.NavigateUrl = "OrderAgain.aspx?Member_Order_ID=" + Member_order_ID;
}
}
}
}
----------------------------------
为什么hyl.NavigateUrl得值是一样的,都是最后一个
{
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
{
foreach (GridViewRow row in this.GridView1.Rows)
{
HyperLink link = (HyperLink)e.Row.Cells[4].Controls[0];
string Member_order_ID = link.Text.Trim();
if (e.Row.Cells[5].Text == "重复消费")
{
HyperLink hyl = (HyperLink)row.FindControl("EditID");
hyl.NavigateUrl = "OrderAgain.aspx?Member_Order_ID=" + Member_order_ID;
}
}
}
}
----------------------------------
为什么hyl.NavigateUrl得值是一样的,都是最后一个
解决方案 »
- 更新不到数据库中
- 新手,连接数据库问题
- 学习PETSHOP中的数据记录方式的疑问
- petshop.orderProcessor.vshost.exe 大家在安装petshop4.0以后的日子里有没有看见过这个进程?
- 如何在<%# DataBinder.Eval(Container, "DataItem.News_Title") %>使用自已定义的函数?????
- objXSLDoc = new ActiveXObject("Microsoft.XMLDOM");在win98第一版下支持吗?
- 有高难度问题求教高手啊
- 用户上传视频过程中转成flv格式方法?
- DropDownList的問題:關于datavalue和datatext, 初學者,請多多關照.
- 有关treeview和框架的问题!!去年都没想出来!
- 如何获取asp.net日历控件当前日期?
- asp.net中将数据库数据导出为xml文件
HyperLink link = (HyperLink)e.Row.Cells[4].Controls[0];
string Member_order_ID = link.Text.Trim();
if (e.Row.Cells[5].Text == "重复消费")
{
HyperLink hyl = (HyperLink)e.Row.FindControl("EditID");
hyl.NavigateUrl = "OrderAgain.aspx?Member_Order_ID=" + Member_order_ID;
}
如果不行就在绑定后的代码中用下面的
foreach (GridViewRow row in this.GridView1.Rows)
{
//把e.Row改为row
HyperLink link = (HyperLink)row.Cells[4].Controls[0];
string Member_order_ID = link.Text.Trim();
if (row .Cells[5].Text == "重复消费")
{
HyperLink hyl = (HyperLink)row.FindControl("EditID");
hyl.NavigateUrl = "OrderAgain.aspx?Member_Order_ID=" + Member_order_ID;
}