LinkButton's not firing GridView_RowCommand

nickriyadh

New Member
I have a LinkButton inside a GridView that passes a CommandArgument and tries to fire RowCommandGridView declaration:\[code\]<asp:GridView PageIndex="0" OnRowCommand="GridView1_RowCommand" PageSize="10" AllowPaging="true" OnPageIndexChanging="GridView1_PageIndexChanging"ID="GridView1" runat="server" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None"BorderWidth="1px" CellPadding="4" ForeColor="Black" GridLines="Horizontal" Width="700px"AutoGenerateColumns="False" OnPageIndexChanged="GridView1_PageIndexChanged">\[/code\]LinkButton inside the GridView:\[code\]<asp:TemplateField> <ItemTemplate> <asp:LinkButton ID="LinkButton1" OnClientClick="return confirm('Are you sure you want to delete this checklist?');" runat="server" CausesValidation="false" CommandName="DeleteChecklist" CommandArgument='<%# Eval("refID") %>' Text="Delete"></asp:LinkButton> </ItemTemplate> <ItemStyle ForeColor="Black" /> <ControlStyle BorderStyle="None" ForeColor="Black" /></asp:TemplateField>\[/code\]Code behind:\[code\]protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e){ if (e.CommandName == "DeleteChecklist") { string refID = e.CommandArgument.ToString(); DAL.DeleteChecklist(refID); }}\[/code\]I placed a breakpoint at RowCommand but it doesn't get fired at all, any idea why?
 
Back
Top