Detecting a page refresh on a GridView RowCommand

Discussion in 'ASP .Net' started by Larrybud, Jan 14, 2009.

  1. Larrybud

    Larrybud Guest

    Hi All. ASP.Net 2.0

    The scenario:
    I have a gridview with a template column with a custom rowcommand
    image button.

    In short, the rowcommand fires some code behind which inserts a
    row into a SQL table with some unique values, then does a
    RegisterStartupScript which does a window.open. The page in the
    window.open logs a user in using the unique values that were saved
    in the SQL table and which were passed to the page in the
    querystring.

    So in effect, this allows an Admin to log in as a user for this
    particular site without knowing their credentials. Technically I
    could just open a hyperlink, but this wouldn't be secure as the
    URL could be copied. With my method, once the page in the
    window.open page logs the user in, those unique values are deleted
    from SQL, so even if a user could copy the URL, it won't
    automatically log the user in.

    The Problem:
    All of this works fine, except when the page with the gridview is
    refreshed after the rowcommand takes place, or if a user navigates
    away from that page and goes back. At that point, the rowcommand
    is called again, thus opening another new window.

    What I need:
    So what I need to do is to be able to tell if the RowCommand was a
    refresh, or if it was the original click.

    Any way to tell? TIA.
    Larrybud, Jan 14, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    5,822
  2. Zule
    Replies:
    1
    Views:
    5,338
  3. keithb
    Replies:
    1
    Views:
    4,304
    PeterKellner
    Jun 10, 2006
  4. Kevin Attard

    GridView RowCommand event not firing!!

    Kevin Attard, Aug 8, 2006, in forum: ASP .Net
    Replies:
    8
    Views:
    31,636
    Lawrence Mucheka
    May 29, 2008
  5. HeavyMetal

    GridView RowCommand problem: GridView Nested in Repeater

    HeavyMetal, Aug 8, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    799
    HeavyMetal
    Aug 8, 2006
Loading...

Share This Page