This topic is locked
[SOLVED]

"View as" settings add Hyperlink open in new popup window

11/24/2021 11:07:41 PM
ASPRunner.NET General questions
E
erosolmi author

Please inside View as Settings / Hyperlink: add option to open the link into a new popup window allowing specification of width/height

Very often a record field contains an hyperlink calculated by the query.
It would be very handy to have the option to open in a popup window without the need to write any code

Thanks

Admin 11/25/2021

Thank you for your suggestion. It makes sense but it is also very easy to implement using the code and we do not like add add every possible option that can be implemented with a bit of the code.

You can use 'View as' Custom and in your code you can either use the standard Javascript window.open() function or use can use Runner.displayPopup() function.

E
erosolmi author 11/29/2021

In which code?
If I choose "Custom" I can only enter C# or VB code and not JS code

Admin 11/29/2021

In your 'View as' Custom code you need to use C# or VB.NET to output HTML that also contains Javascript. Here is the example of HTML that you need to output:
<a href="#" onClick="window.open('http://www.yahoo.com', '_blank')">test</a>

E
erosolmi author 11/29/2021

window.open just open a new page and is not what I want. User must remain in the same page.
Web site is used into a html control view inside a iPad native application

I added the following in Custom view

value = "<a href=""#"" onclick=""var popup = Runner.displayPopup( { url: '" + data("WEB_B2B_Cliente_Link").ToString() + "', width: 1024, height: 768, header: 'Dati Cliente' }); "">Info</a>"

It works ... popup window is opened, page is loaded with data of current customer (data("WEB_B2B_Cliente_Link") contains a link specific for each customer) ... but popup window closes immediately after 2 seconds

Admin 11/29/2021

This is strange, I don't see anything in this code that would cause this kind of behaviour. Maybe some browser plugin causes this?

E
erosolmi author 11/30/2021

Ok solved.

Inside "View As/Edit As" Custom I added the following VB code:

value = "<a href=""#"" onclick=""var popup = Runner.displayPopup( { url: '" + data("WEB_B2B_Cliente_Link").ToString() + "', width: 900, height: 650, header: 'Dati Cliente' }); return false; "">Info</a>"

Returning false from js makes the Popup window remain visible ontop of the current window.