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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to pop up a web form as a modal dialog box??

How to pop up a web form as a modal dialog box??

Scheduled Pinned Locked Moved ASP.NET
htmltoolshelptutorialquestion
3 Posts 3 Posters 1 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.
  • K Offline
    K Offline
    kvPriya
    wrote on last edited by
    #1

    Hi, I've two webforms. When a condition is satisfied, I need to pop up a webform as a modal dialog box where the user can enter some text.After submitting this child form, the user had to be redirected to some other webform. Inorder to catch the text,I've used a session variable. What I've worked is...... In html page, I've written function giveReason(w,h) { wleft = (screen.width-w) / 2; wtop = (screen.height-h) / 2; imgwindow1=window.open("HiReason.aspx","imgwindow1","width="+w+",height="+h+",left="+wleft+",top="+wtop+"status:Yes;"); imgwindow1.focus(); } And I've called the above script function in codebehind page as... jstr = " giveReason(500,170);" Page.RegisterClientScriptBlock("reasonKey", jstr) After that... In child form, Dim strjscript As String = "" strjscript = "" strjscript &= "window.opener.Home.Text1.focus();" strjscript &= "window.close();" strjscript = strjscript & "</script" & ">" RegisterClientScriptBlock("close", strjscript) Home is some other webbform's id. While running this,I'm getting the error.... "imgwindow1 is null or not an object. poop up window is blocked" Any suggestions?? Thanks in advance.... -Priya </x-turndown>

    V 1 Reply Last reply
    0
    • K kvPriya

      Hi, I've two webforms. When a condition is satisfied, I need to pop up a webform as a modal dialog box where the user can enter some text.After submitting this child form, the user had to be redirected to some other webform. Inorder to catch the text,I've used a session variable. What I've worked is...... In html page, I've written function giveReason(w,h) { wleft = (screen.width-w) / 2; wtop = (screen.height-h) / 2; imgwindow1=window.open("HiReason.aspx","imgwindow1","width="+w+",height="+h+",left="+wleft+",top="+wtop+"status:Yes;"); imgwindow1.focus(); } And I've called the above script function in codebehind page as... jstr = " giveReason(500,170);" Page.RegisterClientScriptBlock("reasonKey", jstr) After that... In child form, Dim strjscript As String = "" strjscript = "" strjscript &= "window.opener.Home.Text1.focus();" strjscript &= "window.close();" strjscript = strjscript & "</script" & ">" RegisterClientScriptBlock("close", strjscript) Home is some other webbform's id. While running this,I'm getting the error.... "imgwindow1 is null or not an object. poop up window is blocked" Any suggestions?? Thanks in advance.... -Priya </x-turndown>

      V Offline
      V Offline
      varshavmane
      wrote on last edited by
      #2

      Instead use this var winSettings = "dialogWidth:350px;dialogHeight:300px; help: no; status: no"; var qs = "../Calender/Calender.aspx"; var values = window.showModalDialog(qs,'cal',winSettings); Where values will have all the return values from child form. In Child Form: var MyArgs = new Array(); MyArgs[0] = value1; MyArgs[1] = value2; window.returnValue = MyArgs; window.close(); I hope this will help u.If not let me know.

      V 1 Reply Last reply
      0
      • V varshavmane

        Instead use this var winSettings = "dialogWidth:350px;dialogHeight:300px; help: no; status: no"; var qs = "../Calender/Calender.aspx"; var values = window.showModalDialog(qs,'cal',winSettings); Where values will have all the return values from child form. In Child Form: var MyArgs = new Array(); MyArgs[0] = value1; MyArgs[1] = value2; window.returnValue = MyArgs; window.close(); I hope this will help u.If not let me know.

        V Offline
        V Offline
        Vasudevan Deepak Kumar
        wrote on last edited by
        #3

        showModal is IE specific. Netscape needs workarounds using blurring and focussing techniques and tricks. Vasudevan Deepak Kumar Personal Homepage namespace LavanyaDeepak
        Personal Weblog
        The World of Deepak and Lavanya
        ViewPoint 24x7

        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