前台代码:
1
<asp:LinkButton ID="Delete" Text ="删除" runat ="server" CommandName="Delete" CommandArgument ='<%#Eval("ID","{0}") %>'
2
OnCommand="Delete_OnClick"/>
后台代码:
protected
void
Delete_OnClick(
object
sender, CommandEventArgs ce )
{
try
{
rt.Delete( int.Parse (ce.CommandArgument .ToString ()) );
if ( int.Parse( Session["GVState"].ToString( ) ) < 0 )
{
Session["GridView"] = rt.select( );
GridView1.DataSource = rt.select( );
GridView1.DataBind( );
}
else
{
Session["GridView"] = rt.select( txtKey.Text, cbIsInPos.Checked, FilePath );
GridView1.DataSource = rt.select( txtKey.Text, cbIsInPos.Checked, FilePath );
GridView1.DataBind( );
}
}
catch ( Exception ex )
{
txtErrorMessage.Text = ex.Message;
}
}

1

2

后台代码:
























本文转自today4king博客园博客,原文链接:http://www.cnblogs.com/jinzhao/archive/2008/01/19/1045590.html,如需转载请自行联系原作者