以下是GridView 下的  <asp:TemplateField HeaderText="编辑">
                        <ItemStyle Width="10%" />
                        <ItemTemplate>
                            <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("TypeID", "AddEdit_Info.aspx?rotID={0}") %>'
                                Text="编辑"></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
请问我怎么样在后台改变它的NavigateUrl地址啊?主要就是判断AddEdit_Info.aspx?rotID={0}这后面是否多传一个值,望大家指点,谢谢

解决方案 »

  1.   

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    HyperLink ctrl = e.Row.Cells[2].FindControl("link") as HyperLink;
                    HyperLink link = ctrl as HyperLink;
                    link.NavigateUrl =??????/
                    }
                }
            }
      

  2.   

    foreach(GridViewRow gr in this.Gridview1.Rows)
    {
    HyperLink  h=(HyperLink)gr.FindControl("HyperLink1");
    h.NavigateUrl="";
    }
    或在RowDataBound里通过 e.Row.FindControl查找控件
      

  3.   


    可以多传值,NavigateUrl的字符串里面用&连接不同参数