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. Web Development
  3. ASP.NET
  4. Creating an Alert box in an Atlas UpdatePanel?

Creating an Alert box in an Atlas UpdatePanel?

Scheduled Pinned Locked Moved ASP.NET
javascriptcssquestion
5 Posts 3 Posters 0 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.
  • X Offline
    X Offline
    Xpnctoc
    wrote on last edited by
    #1

    I've got a web project using Atlas. The web project also uses a master page. On one page, I need an alert box to pop up roughly half of the time the UpdatePanel is refreshed, and the text of the alert box needs to be dependent on the outcome of code executed before the UpdatePanel is re-rendered. Concretely: The page has a GridView that is filtered by radio button options, and there are some action buttons under the GridView. If the radio button selection is changed, I don't want an alert box to pop up. But if an action button under the grid is clicked, I want an alert box to pop indicating the outcome of the operation. I have tried writing dynamic JS directly into the UpdatePanel through the use of a Literal control, and I have tried using RegisterClientScriptBlock(). But in neither case has my alert box actually come up when I click one of my action buttons. Any ideas? Thanks.

    B A 2 Replies Last reply
    0
    • X Xpnctoc

      I've got a web project using Atlas. The web project also uses a master page. On one page, I need an alert box to pop up roughly half of the time the UpdatePanel is refreshed, and the text of the alert box needs to be dependent on the outcome of code executed before the UpdatePanel is re-rendered. Concretely: The page has a GridView that is filtered by radio button options, and there are some action buttons under the GridView. If the radio button selection is changed, I don't want an alert box to pop up. But if an action button under the grid is clicked, I want an alert box to pop indicating the outcome of the operation. I have tried writing dynamic JS directly into the UpdatePanel through the use of a Literal control, and I have tried using RegisterClientScriptBlock(). But in neither case has my alert box actually come up when I click one of my action buttons. Any ideas? Thanks.

      B Offline
      B Offline
      bokuceres
      wrote on last edited by
      #2

      for as long as i knew, showing alert box in update panel can't be done. i don't know if there is any funky method to achieve this goal. when i was in the project that change application's framework 1.1 to 2.0 with asp.net AJAX, the solution to this problem is providing a label control that hidden or visible = false. if you want to show any message just show the label and assign it with some string value. you can add font-color = "red" if you want to, and font-size = "even blind man can see" i hope this help, if you have the funky method that i'm talking about above, please tell me what your method is ... :) thx fellow developer...

      X 1 Reply Last reply
      0
      • B bokuceres

        for as long as i knew, showing alert box in update panel can't be done. i don't know if there is any funky method to achieve this goal. when i was in the project that change application's framework 1.1 to 2.0 with asp.net AJAX, the solution to this problem is providing a label control that hidden or visible = false. if you want to show any message just show the label and assign it with some string value. you can add font-color = "red" if you want to, and font-size = "even blind man can see" i hope this help, if you have the funky method that i'm talking about above, please tell me what your method is ... :) thx fellow developer...

        X Offline
        X Offline
        Xpnctoc
        wrote on last edited by
        #3

        I am using hidden labels with bold red text right now. The problem is a bunch of the moron users have 800 x 600 screen res. I started getting flooded with complaints, "I never saw a confirmation message..." So my client asked me to take out all of the labels and replace them with alert boxes. When the alert box experiment failed, I tried using JS code to force the browser to scroll back to the top of the page. That failed too. That's when I began thinking there's a problem with rendering JS in a refreshed UpdatePanel. If it can't be done, then I'll just tell my client that that's the case, and that the next solution is to move the messages from the top of the screen to just above the buttons they click. Thanks for your help.

        B 1 Reply Last reply
        0
        • X Xpnctoc

          I am using hidden labels with bold red text right now. The problem is a bunch of the moron users have 800 x 600 screen res. I started getting flooded with complaints, "I never saw a confirmation message..." So my client asked me to take out all of the labels and replace them with alert boxes. When the alert box experiment failed, I tried using JS code to force the browser to scroll back to the top of the page. That failed too. That's when I began thinking there's a problem with rendering JS in a refreshed UpdatePanel. If it can't be done, then I'll just tell my client that that's the case, and that the next solution is to move the messages from the top of the screen to just above the buttons they click. Thanks for your help.

          B Offline
          B Offline
          bokuceres
          wrote on last edited by
          #4

          Anytime dude... :)

          1 Reply Last reply
          0
          • X Xpnctoc

            I've got a web project using Atlas. The web project also uses a master page. On one page, I need an alert box to pop up roughly half of the time the UpdatePanel is refreshed, and the text of the alert box needs to be dependent on the outcome of code executed before the UpdatePanel is re-rendered. Concretely: The page has a GridView that is filtered by radio button options, and there are some action buttons under the GridView. If the radio button selection is changed, I don't want an alert box to pop up. But if an action button under the grid is clicked, I want an alert box to pop indicating the outcome of the operation. I have tried writing dynamic JS directly into the UpdatePanel through the use of a Literal control, and I have tried using RegisterClientScriptBlock(). But in neither case has my alert box actually come up when I click one of my action buttons. Any ideas? Thanks.

            A Offline
            A Offline
            anurag veda
            wrote on last edited by
            #5

            Hi, Me too had similar problem. Try using following code private void ShowMessage(string message) { //This code works if there's no UpdatePanel //string script = "<script type=\"text/javascript\">alert('" + message + "');</script>"; //Page.ClientScript.RegisterStartupScript(this.GetType(), new Guid().ToString(), script); //Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); // We must do something slightly different with an UpdatePanel string jScript = "alert('" + message + "');"; ScriptManager.RegisterClientScriptBlock(UpdatePanelNewsLetter, UpdatePanelNewsLetter.GetType(), new Guid().ToString(), jScript, true); } now call the ShowMessage() function wherever required in UpdatePanel Regards...

            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