showModalDialog and TreeView problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David

    showModalDialog and TreeView problem

    Hi all,

    I am opening a webform with showModalDialog . This appears to pop-up fine,
    though I have a problem...

    Inside the webform is a treeview control.

    When the treeview is populated, I am setting the treenode navigateurl to
    javascript:Clic k('test')

    This does not work. It opens a new window with javascript:Clic k('test') as
    the address.

    However, if I open the window with window.open, the javascript works fine.

    Anyone any ideas on how I can get it to work?


    Further notes...
    I was trying to see if it was a general issue with JS, so I create an a href
    tag with exactly the same javascript. This worked as expected, so it appears
    to be a conflict with the treeview when inside a showModalDialog .

    Best regards,
    Dave Colliver.

    ~~
    http://www.FOCUSPortals.com - Local franchises available


  • Mark Rae [MVP]

    #2
    Re: showModalDialog and TreeView problem

    "David" <david.colliver .NEWS@revilloc. REMOVETHIS.comw rote in message
    news:OsS5r4mcIH A.1212@TK2MSFTN GP05.phx.gbl...
    I am opening a webform with showModalDialog . This appears to pop-up fine,
    though I have a problem...
    >
    Inside the webform is a treeview control.
    >
    When the treeview is populated, I am setting the treenode navigateurl to
    javascript:Clic k('test')
    >
    This does not work. It opens a new window with javascript:Clic k('test') as
    the address.
    >
    However, if I open the window with window.open, the javascript works fine.
    >
    Anyone any ideas on how I can get it to work?
    Firstly, I would advise you not to use showModalDialog because it is
    non-standard and available only in IE and Safari. There are much better
    solutions available, especially if you are using AJAX...

    However, if you must use showModalDialog , you could try putting

    <base target="_self" />

    in the <headersectio n of the page:



    --
    Mark Rae
    ASP.NET MVP


    Comment

    • David

      #3
      Re: showModalDialog and TreeView problem

      "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
      news:%23rOlTnoc IHA.2000@TK2MSF TNGP05.phx.gbl. ..
      "David" <david.colliver .NEWS@revilloc. REMOVETHIS.comw rote in message
      news:OsS5r4mcIH A.1212@TK2MSFTN GP05.phx.gbl...
      >
      >I am opening a webform with showModalDialog . This appears to pop-up fine,
      >though I have a problem...
      >>
      >Inside the webform is a treeview control.
      >>
      >When the treeview is populated, I am setting the treenode navigateurl to
      >javascript:Cli ck('test')
      >>
      >This does not work. It opens a new window with javascript:Clic k('test')
      >as the address.
      >>
      >However, if I open the window with window.open, the javascript works
      >fine.
      >>
      >Anyone any ideas on how I can get it to work?
      >
      Firstly, I would advise you not to use showModalDialog because it is
      non-standard and available only in IE and Safari. There are much better
      solutions available, especially if you are using AJAX...
      >
      However, if you must use showModalDialog , you could try putting
      >
      <base target="_self" />
      >
      in the <headersectio n of the page:

      >
      >
      --
      Mark Rae
      ASP.NET MVP
      http://www.markrae.net
      Hi Mark,

      I have that, when I first found the problem, I searched and found the base
      tag, so tried it. It doesn't work. :-(

      (Something I also noted was that the showModalDialog appears to use cached
      pages, I had to open the page in a normal window first before the
      showModalDialog would accept the changed page)

      I thought showModalDialog may not be standards compliant, but I did try it.
      I will probably have to come up with another solution.

      Have I actually found a bug? Can anyone confirm?
      --
      Best regards,
      Dave Colliver.

      ~~
      http://www.FOCUSPortals.com - Local franchises available



      Comment

      • siccolo

        #4
        Re: showModalDialog and TreeView problem

        You may also want to try use frame(s)...
        i.e., let's say your main page is opener.aspx, and the page with
        treeview is child.apsx. Then, create a new page child_frame.asp x, that
        will host child.aspx in iframe element. From your main page,
        opener.aspx, you need to open ShowModalDialog ('child_frame.a spx')...

        HTH,

        .....more at Siccolo Articles http://www.siccolo.com/articles.asp

        Comment

        • David

          #5
          Re: showModalDialog and TreeView problem

          Thanks,

          I may use this method as a treeview can get quite large and if I am keeping
          the page the same size, a frame will help.

          However, I have abandoned the showModalDialog for the time being and the
          page is working fine using window.open. However, I need to somehow make the
          page modal (not critical, but a nice to have... )

          Best regards,
          Dave Colliver.

          ~~
          http://www.FOCUSPortals.com - Local franchises available


          "siccolo" <aleksisa@hotma il.comwrote in message
          news:3e297d89-8002-4371-8705-a730c86f03c5@o1 0g2000hsf.googl egroups.com...
          You may also want to try use frame(s)...
          i.e., let's say your main page is opener.aspx, and the page with
          treeview is child.apsx. Then, create a new page child_frame.asp x, that
          will host child.aspx in iframe element. From your main page,
          opener.aspx, you need to open ShowModalDialog ('child_frame.a spx')...
          >
          HTH,
          >
          ....more at Siccolo Articles http://www.siccolo.com/articles.asp

          Comment

          • Mark Rae [MVP]

            #6
            Re: showModalDialog and TreeView problem

            "David" <david.colliver .NEWS@revilloc. REMOVETHIS.comw rote in message
            news:uEwMx7wcIH A.2688@TK2MSFTN GP06.phx.gbl...
            However, I have abandoned the showModalDialog for the time being
            That's good.
            However, I need to somehow make the page modal (not critical, but a nice
            to have... )
            As I mentioned, this is very easy with AJAX:
            Build web apps and services that run on Windows, Linux, and macOS using C#, HTML, CSS, and JavaScript. Get started for free on Windows, Linux, or macOS.



            --
            Mark Rae
            ASP.NET MVP


            Comment

            • siccolo

              #7
              Re: showModalDialog and TreeView problem

              However, I have abandoned the showModalDialog for the time being and the
              page is working fine using window.open. However, I need to somehow make the
              page modal (not critical, but a nice to have... )
              >
              well, you can still use iframe element - but on/within the same page -
              just set style.display to none when you need to hide iframe. Or you
              can use <divelement and "host" tree view within div element, and set
              style.display to none...

              .... more at http://www.siccolo.com/articles.asp

              Comment

              Working...