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

PanelBar in Master Page

2 Answers 90 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Cameron Arnott
Top achievements
Rank 1
Cameron Arnott asked on 29 Oct 2009, 06:50 AM

I have a PanelBar in a Master Page, and each PanelItem loads a Page in the ContentPlaceHolder.

All works fine execpt the entire Page reloads each time a PanelItem is selected.

Is there any way I can stop this happeneing?


Thanks.

2 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 29 Oct 2009, 08:56 AM
Hi Cameron,

Actually, this is expected behavior as this is how masterpage is used. The masterpage is used for building the layout that will be used for multiple ASPX pages. The ContentPlaceHolder is not an iframe, but an editable area for the ASPX pages.

In order to achieve your goal you can use our RadSplitter control with two panes - in the left pane you can place the panelbar and the new paheges will be loaded in the other pane. Please take a look at this example that shows the needed approach.

Sincerely yours,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Shinu
Top achievements
Rank 2
answered on 29 Oct 2009, 09:59 AM
Hi Cameron,

I tried using iframe in ContentPlaceHolder and changing the src based on the PanelBarItem selection from client side which avoids page refresh and loads the requred page in iframe.

MasterPage:
Javascript:
 
<script type="text/javascript"
    function OnClientItemClicked(sender, args) { 
        var text = args.get_item().get_text(); 
        changeUrl(text); 
    } 
</script> 
[Attach OnClientItemClicked to RadPanelBar]

Default Page:
ASPX:
 
<iframe id="iframe1" src="Default3.aspx"></iframe> 

JavaScript:
 
<script type="text/javascript"
    function changeUrl(text) { 
        var frame = document.getElementById("iframe1"); 
        frame.src = text; 
    } 
</script> 
Note: Here I am passing the page name to the function as parameter (text), you can change logic according to requirement.



-Shinu.
Tags
PanelBar
Asked by
Cameron Arnott
Top achievements
Rank 1
Answers by
Paul
Telerik team
Shinu
Top achievements
Rank 2
Share this question
or