<asp:TemplateField HeaderText="操作区">
                                    <ItemTemplate>
                                     <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Col" 
                                            CommandArgument='<%# Eval("OriginalBillId") %>' Font-Underline="True" 
                                            ForeColor="Blue" >审核</asp:LinkButton>
                                        <asp:LinkButton ID="lnkDelt" Text="删除" CommandName="Del" runat="server" CommandArgument='<%# Eval("AccountPlanId")%>' ></asp:LinkButton>
                                    </ItemTemplate>
 protected void GridApplymoney_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            LinkButton lnkDelt = (LinkButton)e.Row.Cells[2].FindControl("lnkDelt");
            lnkDelt.Attributes.Add("onclick", "return confirm('是否确定删除?')");        }        //设置序号列
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Cells[1].Text = Convert.ToString(((Pager1.CurrentPageIndex - 1) * GridApplymoney.PageSize) + e.Row.RowIndex + 1);
        }
        
        if (e.Row.RowIndex != -1)
        {
            ViewState["DataKey"] = GridApplymoney.DataKeys[e.Row.RowIndex].Value.ToString();            //Response.Write("<script>alert('" + e.Row.RowIndex + "')</script>");
        }
        
    }
 protected void GridApplymoney_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        bool del;
        if (e.CommandName == "Del")
        {
            string Id;
            Id = e.CommandArgument.ToString();            del = FinanceAccountPlansManager.DeleteRecReundApply(Id);
            if (del == true)
            {
                Response.Write("<Script>alert('删除成功!')</Script>");
            }
            else
            {
                Response.Write("<Script>alert('删除失败!')</Script>");
            }            BindGrid();
        }
        if (e.CommandName == "Col")
        {
            Response.Redirect("~/FinanceManage/RefundApply/P_RecReundApplyCheck.aspx?AccountPlanId=" + ViewState["DataKey"].ToString() + "&&OriginalBillId=" + e.CommandArgument.ToString());
        }
    }

解决方案 »

  1.   

    传的都是同一个ID AccountPlanId,终于有人来,O(∩_∩)O~
      

  2.   

    http://localhost:5029/URP.Platform/FinanceManage/RefundApply/P_RecReundApplyCheck.aspx?AccountPlanId=CWJH0000000008&&OriginalBillId=ZSBM0000000001
    都传的这个AccountPlanId=CWJH0000000008
      

  3.   

    ViewState["DataKey"].ToString() 保存的肯定是一个值
    使用Hyperlink
    或a href
      

  4.   

    那个审核和删除要在一起,用Hyperlink
    删除就不是就要在加一列了吗?(我不知道)
      

  5.   

     <asp:HyperLinkField HeaderText="操作区" Text="审核" 
                                        DataNavigateUrlFields="AccountPlanId,OriginalBillId" 
                                        DataNavigateUrlFormatString="P_RecReundApplyCheck.aspx?AccountPlanId={0}&amp;OriginalBillId={1}" />
                                </Columns>这样不好加删除了,还有其他的方法吗?