How to prevent duplication when performing an operation in gridview

I would like to know how to avoid performing the same operation twice after some action has been taken in gridview.

i.e. when a button is clicked in gridview, operations in RowCommand are executed. Then, when you reload the page, the same thing happens again.

How can we avoid this?

Thank!

+3
source share
1 answer

Could you just set the flag and then check if this is true or not. For example, when they press a button, the flag is false, so it executes commands and sets the flag to true. When they are updated, the flag is true, and does not execute the command.

. , .

if(flag==false)
{
    //RowCommand Operations
    flag=true;
}

"",

if(myLabel.Text=="")
{
     //RowCommand Operations
     myLabel.Text="Something Else";
}
+2

Source: https://habr.com/ru/post/1753333/


All Articles