Error Only in Firefox

J

Joey

asp.net 2/C#/VS2005

I have a webform that contains gridview that is databound to a dataset
maintained in session state. Users can enter values into textboxes and
add to the grid. For each row in the grid, there is a command field
called Delete...it allows them to remove the entries if necessary. I
can add just fine from both IE and Firefox, and I can delete just fine
from IE. But when I try to delete a row from Firefox, I get the
following error...


Thre is no row at position 0


....I am handling the delete in the gridview's RowDeleting handler.
Below is the code...


protected void grdMyGrid_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{

((DataSet)this.Session["MyDataSet"]).Tables["MyTable"].Rows[e.RowIndex].Delete();

this.grdMyGrid.DataSource=((DataSet)this.Session["MyDataSet"]);
this.grdMyGrid.DataMember="MyTable";
this.grdMyGrid.DataBind();
}


....the first line inside the function block is what throws the error.
In debug mode I can see that e.RowIndex is always equal to 0. So why
does this work fine in IE but not in Firefox? Why am I getting the
error when using Firefox?

TIA
 
J

Joey

asp.net 2/C#/VS2005

I have a webform that contains gridview that is databound to a dataset
maintained in session state. Users can enter values into textboxes and
add to the grid. For each row in the grid, there is a command field
called Delete...it allows them to remove the entries if necessary. I
can add just fine from both IE and Firefox, and I can delete just fine
from IE. But when I try to delete a row from Firefox, I get the
following error...

Thre is no row at position 0

...I am handling the delete in the gridview's RowDeleting handler.
Below is the code...

protected void grdMyGrid_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{

((DataSet)this.Session["MyDataSet"]).Tables["MyTable"].Rows[e.RowIndex].Del­ete();

this.grdMyGrid.DataSource=((DataSet)this.Session["MyDataSet"]);
this.grdMyGrid.DataMember="MyTable";
this.grdMyGrid.DataBind();

}

...the first line inside the function block is what throws the error.
In debug mode I can see that e.RowIndex is always equal to 0. So why
does this work fine in IE but not in Firefox? Why am I getting the
error when using Firefox?

TIA

NEW INFO:

I have discovered that the error is being caused because the table in
my dataset (in Session) is empty when the GridView's Row_Deleting
event fires -> if I'm using Firefox. It apparently gets emptied out
somehow before the Row_Deleting function when using Firefox??? I know
that it takes the value initially, because the row shows in the table
after doing a databind, while using Firefox.

To troubleshoot, I checked Rows.Count for the Session's dataset's
table, from within the top of the Row_Deleting function. When I use
Internet Explorer, Count returns 1. When I use Firefox, Count returns
0. This is the exact same compiled/published code.

What's going on here?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top