This is a migrated thread and some comments may be shown as answers.

RadPane - before navigate event?

3 Answers 41 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
richard
Top achievements
Rank 1
richard asked on 30 Nov 2011, 11:08 AM
Is there a 'before navigate' type event for the RadPane control?

I am using a RadPane control, and initially setting the ContentURL.

When a user clicks a link in the content of the RadPane I would like to capture the 'navigating to URL' of the link in the code behind.

Please can you suggest how this could be done.


 

3 Answers, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 30 Nov 2011, 04:13 PM
Hi Richard,

RadPane does not offer such event and in the general case such implementation is not possible. The main problem comes from the fact that if the content loaded inside <iframe> is from another domain, it is not possible to access its document and window objects, and they contain the information of address of the currently displayed page.

Nevertheless, if the pages displayed inside the pane are from within the application, you can achieve the required functionality by manually handling the link's click event and initiate AJAX call to pass the href attribute of the link on the server.

Best wishes,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
richard
Top achievements
Rank 1
answered on 01 Dec 2011, 04:34 PM

Hi Dobromir,

thank you for your reply, I think I understand now.

I did find this javascript relating to a similar issue with Iframes:


    alert(document.getElementById(
'youriframe').contentWindow.location.href);

The above however throws a permission denied error for on external site, as per your explanation.

What troubles me though is the page URL would be available if browsing in the normal way, so I don't understand why it shouldn't be available from an IFrame.

suppose there is a security reason for not allowing access to the dom but you can do from a Internet Explorer toolbar application  - as Google toolbar does in order to highlight search terms.

So why not expose the URL in an IFrame - I guess the RadPane is essentially a subclassed IFrame and is restricted in the same way.


Thanks

0
Dobromir
Telerik team
answered on 05 Dec 2011, 06:05 PM
Hi Richard,

As you guessed when RadPane is configured to display an external content (by setting ContentUrl), this content is displayed in an <iframe>. However, the restriction to access some of the properties of the <iframe> when loading content from different domain are not applied by RadPane, but this is a general security restriction in JavaScript.

All the best,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
General Discussions
Asked by
richard
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
richard
Top achievements
Rank 1
Share this question
or