Home All Groups Group Topic Archive Search About
Author
18 Oct 2006 10:33 PM
J Li
In the footer of the gridview, I have a dropdown and a "Add" button set up,
so I can add new rows to the gridview.  The "Add" button has CommandName of
"ADD", so I use that in the GridView1_RowCommand to check if (e.CommandName
== "ADD") before I add the row.

Everything works fine except, after adding a row, then I hit the refresh
button in the browser, another row got added because the commandname in the
RowCommand Event is still "ADD".

Author
19 Oct 2006 10:13 AM
kan
hai J li..
    wats ur problem tell me exactly Li.. u need to refresh the page
when add is clicked or ?

J Li wrote:
Show quoteHide quote
> In the footer of the gridview, I have a dropdown and a "Add" button set up,
> so I can add new rows to the gridview.  The "Add" button has CommandName of
> "ADD", so I use that in the GridView1_RowCommand to check if (e.CommandName
> == "ADD") before I add the row.
>
> Everything works fine except, after adding a row, then I hit the refresh
> button in the browser, another row got added because the commandname in the
> RowCommand Event is still "ADD".
Author
19 Oct 2006 11:38 AM
RBM
J Li wrote:

> In the footer of the gridview, I have a dropdown and a "Add" button set up,
> so I can add new rows to the gridview.  The "Add" button has CommandName of
> "ADD", so I use that in the GridView1_RowCommand to check if (e.CommandName
> == "ADD") before I add the row.
>
> Everything works fine except, after adding a row, then I hit the refresh
> button in the browser, another row got added because the commandname in the
> RowCommand Event is still "ADD".

What kind of browser are you using? You should get a warning you are
doing a post request in most browsers.

For a work around you could set your rowcommand to an other string
after the execution of the method. This will be kind of:
if (e.CommandName == "ADD")
{
// your code
}
e.CommandName = "Cancel";