wrexhamafc234
Programmer
I have the following gridview defined on my page:
Whenever the 'Delete' button on a row is clicked, the following fucntion will be called:
This is where my problem begins. In order for me to delete a row, I will be requiring to retrive the TableID. However, each and every time, TableID will be returned as 0 (zero). Why am I not getting any values within e.CommandArgument?
Code:
<asp:GridView ID="GridView1" runat="server" CellPadding="3" DataSourceID="ObjectDataSource1" GridLines="Vertical" onrowcommand="GridView1_RowCommand" AllowSorting="True" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" Width="700px">
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="Gainsboro" />
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
</Columns>
</asp:GridView>
Whenever the 'Delete' button on a row is clicked, the following fucntion will be called:
Code:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
int TableID = Convert.ToInt32(e.CommandArgument);
}
else if (e.CommandName == "Edit")
{
}
}
This is where my problem begins. In order for me to delete a row, I will be requiring to retrive the TableID. However, each and every time, TableID will be returned as 0 (zero). Why am I not getting any values within e.CommandArgument?