GridView的RowCommand事件传两个或以上参数

GridView 传两个参数:

前台:

  <asp:TemplateField>
                                <HeaderTemplate>
                                    查看详情</HeaderTemplate>
                                <ItemTemplate>
                                    <asp:LinkButton SkinID="lnkbtn" ID="lnkbtnList" runat="server" CommandArgument='<%#Eval("INITACCEP_ID")+","+Eval("INITACCEPT_STATE")%>'
                                        CommandName="List">详情</asp:LinkButton></ItemTemplate>
                            </asp:TemplateField>  

//后台

//详情
    protected void gvFinalAcceptList_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        Response.Redirect("InitAcceptDetail.aspx?OBJECT_ID=" + Server.UrlEncode(ViewState["OBJECT_ID"].ToString()) + "&INITACCEP_ID=" + Server.UrlEncode(e.CommandArgument.ToString()));
    }

//到另一个页面获取时 进行截取 获取:

  //获取初验说明编号及竣工状态
            string receivalInit = Server.UrlDecode(Request.QueryString["INITACCEP_ID"].ToString());
            //对 receivalInit进行截取 截取ID及状态
            string [] init = receivalInit.Split(',');
            string initId = init[0].ToString();
            string CompleteState = init[1].ToString();

 

 

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(GridView)