You need to assign CommandName LinkButton column in the GridView markup. From there, you will also need to hook up the OnRowCommand event to process your Close command.
The following is an example of using the Add command on a GridView :
Markup: <asp:gridview id="ContactsGridView" datasourceid="ContactsSource" allowpaging="true" autogeneratecolumns="false" onrowcommand="ContactsGridView_RowCommand" runat="server"> <columns> <asp:buttonfield buttontype="Link" commandname="Add" text="Add"/> <asp:boundfield datafield="ContactID" headertext="Contact ID"/> <asp:boundfield datafield="FirstName" headertext="First Name"/> <asp:boundfield datafield="LastName" headertext="Last Name"/> </columns> </asp:gridview> Code-Behind: void ContactsGridView_RowCommand(Object sender, GridViewCommandEventArgs e) {
source share