protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowIndex != -1)
{
((HyperLink)e.Row.FindControl("HyperLinkEdit")).Attributes.Add("onclick", "window.showModalDialog('edit.aspx?id=" + this.GridView1.DataKeys[e.Row.RowIndex].Value.ToString() + "','','width=610px,height=635px,top=40px,left=150px')");
}
}
{
if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowIndex != -1)
{
((HyperLink)e.Row.FindControl("HyperLinkEdit")).Attributes.Add("onclick", "window.showModalDialog('edit.aspx?id=" + this.GridView1.DataKeys[e.Row.RowIndex].Value.ToString() + "','','width=610px,height=635px,top=40px,left=150px')");
}
}
本文介绍如何在ASP.NET中使用GridView控件时,为每一行添加编辑链接,点击后通过弹窗方式打开编辑页面,并传递当前行的ID参数。
3557

被折叠的 条评论
为什么被折叠?



