在GridView添加一个按钮,使其能够自由触发事件 在GridView中增加事件 onrowcommand="GridView1_RowCommand" 自定义按钮 <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete" onclientclick="return confirm("确定要删除备份记录吗?")" 主要就是它的CommandName的属性 后台代码protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { int row = ((GridViewRow)((Button)e.CommandSource).NamingContainer).RowIndex; } }