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. Java script in client level

Java script in client level

Scheduled Pinned Locked Moved ASP.NET
toolsjavajavascriptcomtesting
4 Posts 4 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.
  • P Offline
    P Offline
    padmanabhan N
    wrote on last edited by
    #1

    Hi Experts, I am showing a alert in code level like, Page.RegisterStartupScript("Error", "<script language=javascript> alert('Error while validating the imported CRF Mapping excel! Check the imported file for more Error Messages ');</script>"); My requirement is, i want to generate a excel file after clicking ok button in the alert but when i write the code below the RegisterStartupScript then both the alert and then file generation is done at the same time. I want to generate the file only after i click ok in alert. Any sugession are highly appreciated!!!!!!!

    Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

    A S L 3 Replies Last reply
    0
    • P padmanabhan N

      Hi Experts, I am showing a alert in code level like, Page.RegisterStartupScript("Error", "<script language=javascript> alert('Error while validating the imported CRF Mapping excel! Check the imported file for more Error Messages ');</script>"); My requirement is, i want to generate a excel file after clicking ok button in the alert but when i write the code below the RegisterStartupScript then both the alert and then file generation is done at the same time. I want to generate the file only after i click ok in alert. Any sugession are highly appreciated!!!!!!!

      Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

      A Offline
      A Offline
      Anurag Gandhi
      wrote on last edited by
      #2

      What is the error you are getting? I would suggest, instead of using RegisterStartupScript, use alert on client side event only. And onClick of "Ok" from alert, post back to the server and generate the excel file. Is it helping you? If not, please elaborate your question.

      Anurag Gandhi.
      http://www.gandhisoft.com
      Life is a computer program and every one is the programmer of his own life.
      My latest article: Group GridView Data

      1 Reply Last reply
      0
      • P padmanabhan N

        Hi Experts, I am showing a alert in code level like, Page.RegisterStartupScript("Error", "<script language=javascript> alert('Error while validating the imported CRF Mapping excel! Check the imported file for more Error Messages ');</script>"); My requirement is, i want to generate a excel file after clicking ok button in the alert but when i write the code below the RegisterStartupScript then both the alert and then file generation is done at the same time. I want to generate the file only after i click ok in alert. Any sugession are highly appreciated!!!!!!!

        Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

        S Offline
        S Offline
        scy278753517
        wrote on last edited by
        #3

        AS the reason of page life cycle of asp.net, so if you generate the excel file in the backend using C#,it will works out the excel first then the alert. you needn't put the alert phrase into the backend,just write it on the frontend , using a function to to represent it,alertme for example , then in the asp.net button ,you just register the following code : onclientclick="alertme();" best regards...thx

        I can do!

        1 Reply Last reply
        0
        • P padmanabhan N

          Hi Experts, I am showing a alert in code level like, Page.RegisterStartupScript("Error", "<script language=javascript> alert('Error while validating the imported CRF Mapping excel! Check the imported file for more Error Messages ');</script>"); My requirement is, i want to generate a excel file after clicking ok button in the alert but when i write the code below the RegisterStartupScript then both the alert and then file generation is done at the same time. I want to generate the file only after i click ok in alert. Any sugession are highly appreciated!!!!!!!

          Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Did you mean to use confirm instead of alert? Use a hidden field to store a flag variable, After the alert statement (or confirm as the case may be), set the flag and submit the page using JavaScript (window.forms[0].submit). In the code behind Page_Load event, check for the flag and generate the file.

          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