gridview 打开新页 并且传递参数

在 gridbview 中添加模板列

<ItemTemplate>
          <asp:LinkButton ID="LinkButtonReport" runat="server" CausesValidation="False"Font-Size="12px" ForeColor="DimGray" Text="报告单" CommandArgument='<%#Bind("RecNumb")%>' OnCommand="LinkButtonReport_Command"></asp:LinkButton>
                            </ItemTemplate>

然后编写事件

protected void LinkButtonReport_Command(object sender, CommandEventArgs e)
    {
        string RecNumb = e.CommandArgument.ToString();                    //传参,传的是gridview这个行的主键
        //this.ClientScript.RegisterStartupScript(this.GetType(), "NotComplete ", "<script> window.open('ReportsSingle/BBF_Reports_Single.aspx?RecNumb=" + RecNumb + "','_blank','location=no,width=1024,height=768,left=50000,top=5000')</script> ");

        this.ClientScript.RegisterStartupScript(this.GetType(), "NotComplete ", "<script> window.open('ReportsSingle/BBF_Reports_Single.aspx?RecNumb=" + RecNumb + "','_blank','width=1024,height=768')</script> ");
       
    }

原文地址:https://www.cnblogs.com/tongdengquan/p/6090635.html