Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Clever Code
  4. Suppressing modal popup after first view

Suppressing modal popup after first view

Scheduled Pinned Locked Moved Clever Code
1 Posts 1 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marsha Vomastic
    wrote on last edited by
    #1

    Here's something I had trouble getting information about. I added an Ajax modal popup extender to our home page to display a temporary message in a panel. The user could close it manually and a timer closed it automatically after 10 seconds. But if the user navigated away from the home page and then returned, the popup did too, annoying said user and me too. It seemed that it could be suppressed using session state. Trouble was, using IsSessionNew just was not working. After trying many red herrings, this is what worked for me: IsSessionNew seems to not activate until a variable is put into the session. So I made a session variable when the popup is invoked (ModalPopup_ResolveControlID) and used a hidden field to store it (Session("NewSession") = "X") and used that as the target ID of the Ajax ModalPopupExtender. Then I could continue with the show/hide logic.

    If Not IsPostBack Then
    If Session.IsNewSession Then
    ModalPopup.Show()
    Timer1.Enabled = True
    Else
    ModalPopup.Hide()
    End If
    End If

    The timer is in an Ajax timer control within the panel that is popped up. That needs to be suppressed after the first tick or the screen flickers every 10 seconds. On Timer1_Tick, Timer1.Enabled = False

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups