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

radpanelbar how to prevent postback

5 Answers 91 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 15 May 2013, 01:23 PM
hi,

i have a radpanelbar, when i click the parent item or any sub item, the screen reloaded. 

1. how do i prevent the screen from reload the whole page? 
2. i have a radwindow open, when the screen reload or i press F5, the radwindow dissapear. how do i keep the radwindow open after refresh?

thanks,
Richard

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 16 May 2013, 12:46 PM
Hi Richard,

To prevent the whole page reloading you can either add the radpanelbar inside an updatepanel  or add the following js.
1)
Updatepanel method: ASPX
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
   <ContentTemplate>
       <telerik:RadPanelBar ID="RadPanelBar1" runat="server" OnItemClick="RadPanelBar1_ItemClick">
           <Items>
                     ... ... ...   
           </Items>
       </telerik:RadPanelBar>
   </ContentTemplate>
</asp:UpdatePanel>
OR
Attach'OnClientItemClicking' client side event and add the following.
JS:
<script type="text/javascript">
  function OnClientItemClicking(sender, eventArgs)
  {
     eventArgs.set_cancel(true); // Cancel the postback
  }
</script>

2) To retain the window after screen reload set 'VisibleOnPageLoad' of radwindow as true.
ASPX:
<telerik:RadWindow ID="Window1" runat="server" VisibleOnPageLoad="true">
</telerik:RadWindow>

Thanks,
Princy.
0
Tal
Top achievements
Rank 1
answered on 29 Sep 2013, 06:39 PM
Hi Princy,
this is not quite understood.
I tried what you wrote but as a consequence I can't click any item on the menu (method 2).
I method 1 the whole page refreshes.

thanks
0
Boyan Dimitrov
Telerik team
answered on 02 Oct 2013, 11:32 AM
Hello,

In order to avoid full post-back (whole page refresh) you can ajaxify the RadPanelBar control. You can achieve this functionality by simply using the RadAjaxManager as shown in the code snippet below:
//markup code
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadPanelBar1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadPanelBar1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
....
<telerik:RadPanelBar ID="RadPanelBar1" runat="server" OnItemClick="RadPanelBar1_ItemClick">
           ......
</telerik:RadPanelBar>

This will perform a post-back so any server-side logic will be executed but it will not refresh the whole page.


Regards,
Boyan Dimitrov
Telerik
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 the blog feed now.
0
Tal
Top achievements
Rank 1
answered on 03 Oct 2013, 09:11 PM
Hi,
I have this radpanel in my master page.
I also need to have radAjaxManager on other pages  that use the same masterpage.

How can I use these two together?
0
Princy
Top achievements
Rank 1
answered on 04 Oct 2013, 05:06 AM
Hi Tal,

You can programmatically ajaxify the Master Page and Content Page controls. Please have a look into the following code snippet that I tried to ajaxify the Master Page Control in Content Page code behind. For more details please check this documentation.

MasterPage ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>
<telerik:RadPanelBar ID="RadPanelBar1" runat="server" OnItemClick="RadPanelBar1_ItemClick">
    <Items>
        <telerik:RadPanelItem Text="Item1" runat="server">
            <Items>
                <telerik:RadPanelItem Text="Item1.1" runat="server">
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Item1.2" runat="server">
                </telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelItem>
    </Items>
</telerik:RadPanelBar>

Content Page C#:
protected void Page_Load(object sender, EventArgs e)
{
    RadPanelBar panel = (RadPanelBar)Master.FindControl("RadPanelBar1");
    RadAjaxManager AjaxManager = RadAjaxManager.GetCurrent(Page);
    AjaxManager.AjaxSettings.AddAjaxSetting(panel, panel);
}

Thanks,
Princy.
Tags
PanelBar
Asked by
Richard
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Tal
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or