Link to home
Start Free TrialLog in
Avatar of zintech
zintech

asked on

ASP.NET gridview delete linkbutton

I have an ASP.NET GridView that has a LinkButton field for a Delete option on the GridView for each row.  However when I click the Delete LinkButton on the Gridview, it does not do anything.  I have a DELETE command specified on the DataSource that is associated with the Gridview.  I just can't figure out why the Delete command will not fire.  Here is the GridView's code:


<asp:GridView ID="VersionGridView" runat="server" AllowPaging="True"
            AutoGenerateColumns="False" BackColor="White" BorderColor="#E7E7FF"
            BorderStyle="None" BorderWidth="1px" CellPadding="3" DataKeyNames="Id"
            DataSourceID="VersionDataSource" EmptyDataText="No versions."
            onrowcreated="VersionGridView_RowCreated"
            OnRowDeleting="VersionGridView_RowDeleting" PageSize="5"
            style="margin-left: 18px" Width="567px"
            onrowdatabound="VersionGridView_RowDataBound" >
            <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
            <Columns>
                    <asp:TemplateField>
                    <ItemTemplate>
                            <asp:LinkButton ID="LinkButtonDelete" CommandName="Delete" Text="Delete" runat="server"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
            <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
            <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
            <AlternatingRowStyle BackColor="#F7F7F7" />
        </asp:GridView>
ASKER CERTIFIED SOLUTION
Avatar of Vikram Singh Saini
Vikram Singh Saini
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial