473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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:Click('test')

This does not work. It opens a new window with javascript:Click('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.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
Feb 18 '08 #1
6 2590
"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:Os**************@TK2MSFTNGP05.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:Click('test')

This does not work. It opens a new window with javascript:Click('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 <headersection of the page:
http://www.google.co.uk/search?sourc...og+base+target
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Feb 19 '08 #2
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:Os**************@TK2MSFTNGP05.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:Click('test')

This does not work. It opens a new window with javascript:Click('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 <headersection of the page:
http://www.google.co.uk/search?sourc...og+base+target
--
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.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available

Feb 19 '08 #3
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.aspx, that
will host child.aspx in iframe element. From your main page,
opener.aspx, you need to open ShowModalDialog('child_frame.aspx')...

HTH,

.....more at Siccolo Articles http://www.siccolo.com/articles.asp
Feb 19 '08 #4
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.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"siccolo" <al******@hotmail.comwrote in message
news:3e**********************************@o10g2000 hsf.googlegroups.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.aspx, that
will host child.aspx in iframe element. From your main page,
opener.aspx, you need to open ShowModalDialog('child_frame.aspx')...

HTH,

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

Feb 19 '08 #5
"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:uE**************@TK2MSFTNGP06.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:
http://www.asp.net/AJAX/AjaxControlT...odalPopup.aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Feb 19 '08 #6
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
Feb 19 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Scott Lee | last post by:
I am displaying an ASP.Net generated form in a popup opened with window.showModalDialog. The form contains DropDownList controls. The first ddl is populated via databinding to a datatable, has...
3
by: John | last post by:
Hi all, My web app makes use of the ShowModalDialog in a couple of places. In certain instances, the user may click on a "Cancel" image button (there is no code-behind for this) at which point a...
4
by: MW de Jager | last post by:
I want to call ShowModalDialog(...) from my C# code in the code behind page of my aspx page. I do not want to link this to a button, since I want to first do some checking myself before I call the...
1
by: John | last post by:
Hi, I'm having a problem opening / downloading csv files when called from a page opened with window.showModalDialog( ). To isolate this problem, I've written 3 files (see below). 1. main.htm...
2
by: John | last post by:
Hi, I posted this earlier in microsoft.public.dotnet.framework.aspnet, but didn't get a response, so I thought I'd try here. Basically, I'm having a problem opening / downloading csv files...
1
by: Ben Schumacher | last post by:
I keep getting a script error (Expected end of statement) when I try to add the following attribute to a <asp:Button server control. My vb.net looks as follows ... Dim sUrl As String =...
4
by: Ralf | last post by:
Here is my scenerio and what I am doing. I am open to other ways of doing this is it makes sense. I have a cell withing a row within a datagrid. When this cell is clicked (its a date field), I...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.