Prevent LinkButton Command from firing on refresh

I have a LinkButton in a Grid on a page to fire an event.

<asp:LinkButton ID="LinkButton1" CommandName="Select" CommandArgument='<%# Bind("ID") %>' runat="server" OnCommand="LinkButton1_Command">Action</asp:LinkButton>
               
Which works fine when the user presses the button

How do I stop the the command from firing when the page is refreshed?

LVL 2
phunchakAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
phunchakConnect With a Mentor Author Commented:
I found my own solution.  (I was using the command to run a javascript popup)]

After the execution on the server side from LinkButton1_Command, I redirect with a QueryString like,

private void redirect()
{

Response.Redirect("default.aspx?q=success");

}

And if Page_Load event check, if QueryString q = "success" then  I  run any JavaScriptUtilities.PopUp functions.
0
 
sagirCommented:
You mean don't allow it to be pressed again once it for pressed for the first time?
0
 
phunchakAuthor Commented:
I want to allow it to be pressed again....I just don't want it firing when the user refreshes the page.
0
All Courses

From novice to tech pro — start learning today.