<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());
}
}
<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());
}
}
都传的这个AccountPlanId=CWJH0000000008
使用Hyperlink
或a href
删除就不是就要在加一列了吗?(我不知道)
DataNavigateUrlFields="AccountPlanId,OriginalBillId"
DataNavigateUrlFormatString="P_RecReundApplyCheck.aspx?AccountPlanId={0}&OriginalBillId={1}" />
</Columns>这样不好加删除了,还有其他的方法吗?