R
Richard Coltrane
Hi There,
In binding my gridview i do this:
private void BindGrid(int month, int year)
{
BookingProvider provider = new BookingProvider();
DataTable dt = provider.GetMonthsEvent(month, year);
this.gridBookings.DataSource = dt;
this.gridBookings.DataKeyNames = new string[] { "Id" };
this.gridBookings.DataBind();
}
And when deleting a row after a delete command I do this
protected void gridBookings_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{
BookingProvider provider = new BookingProvider();
provider.DeleteBooking((long)(e.Keys["Id"]));
}
How come it fails??? The keys collection is null?
Also e.RowIndex = the key of the row being deleted as per the database??
i.e. RowIndex = Key??
But the docs read like e.RowIndex is supposed to be the index of the row
according to the grid. i.e a grid with 6 rows I would have though the 6 th
row would have a row index of 5 (zero based)???
Thanks
In binding my gridview i do this:
private void BindGrid(int month, int year)
{
BookingProvider provider = new BookingProvider();
DataTable dt = provider.GetMonthsEvent(month, year);
this.gridBookings.DataSource = dt;
this.gridBookings.DataKeyNames = new string[] { "Id" };
this.gridBookings.DataBind();
}
And when deleting a row after a delete command I do this
protected void gridBookings_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{
BookingProvider provider = new BookingProvider();
provider.DeleteBooking((long)(e.Keys["Id"]));
}
How come it fails??? The keys collection is null?
Also e.RowIndex = the key of the row being deleted as per the database??
i.e. RowIndex = Key??
But the docs read like e.RowIndex is supposed to be the index of the row
according to the grid. i.e a grid with 6 rows I would have though the 6 th
row would have a row index of 5 (zero based)???
Thanks