RadPanelBar refreshing the whole page in sharepoint

10 posts, 0 answers
  1. juan
    juan avatar
    10 posts
    Member since:
    Dec 2008

    Posted 08 Dec 2008 Link to this post

    Hi guys,

    I'm having a problem with RadPanelBar. It is refreshing the whole page when I'm using it in SharePoint.

    I did a sample test application without using SharePoint and it is working properly (not refreshing the whole page).

    Below is the sample I create: (Note that this sample is the asp.net, not the SharePoint code as it will be the same).
    Kindly highlight or specify what I did wrong or what I need to do in able to make it work on SharePoint.

    Please be kind as I am not a frequent forum poster. Thanks in advance for the help/support.

    ### Navigation Control: START ###
    === ASCX: START ===
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="navigation.ascx.cs" Inherits="AJAXEnabledWebApplication1.navigation" %>
    <%@ Register Assembly="Telerik.Web.UI, Version=2008.2.826.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
        Namespace="Telerik.Web.UI" TagPrefix="rad" %>
       
    <rad:RadPanelBar runat="server" ID="radPanelBar1" Skin="Office2007" ExpandMode="SingleExpandedItem" Width="100%">
    </rad:RadPanelBar>
    === ASCX: END ===

    === ASCX.CS: START ===

    namespace AJAXEnabledWebApplication1
    {
        public partial class navigation : System.Web.UI.UserControl
        {
            public EventHandler OnItemClick;

            protected void Page_Load(object sender, System.EventArgs e)
            {
                if (!this.IsPostBack)
                {
                    radPanelBar1.DataSource = this.GetData();
                    radPanelBar1.DataTextField = "Desc";
                    radPanelBar1.DataValueField = "Id";
                    radPanelBar1.DataBind();
                }
            }

            protected override void OnInit(System.EventArgs e)
            {
                radPanelBar1.ItemClick += radPanelBar1_ItemClick;
            }

            private void radPanelBar1_ItemClick(object sender, Telerik.Web.UI.RadPanelBarEventArgs e)
            {
                if (OnItemClick != null)
                {
                    OnItemClick(this, new navigation.NavigationEventArgs(e.Item.Value));
                }
            }

            private DataTable GetData()
            {
                DataTable dt = new DataTable();

                dt.Columns.Add("Id");
                dt.Columns.Add("Desc");

                for (int i = 0; i < 5; i++)
                {
                    DataRow newRow = dt.NewRow();

                    newRow["Id"] = i.ToString();
                    newRow["Desc"] = i.ToString() + " Description";

                    dt.Rows.Add(newRow);
                }

                return dt;
            }

            #region <<<EventHandler>>>
            public delegate void EventHandler(object sender, NavigationEventArgs e);

            public class NavigationEventArgs : System.EventArgs
            {
                private string _id = string.Empty;

                public NavigationEventArgs()
                {
                    _id = string.Empty;
                }

                public NavigationEventArgs(string id)
                {
                    _id = id;
                }

                public string Id
                {
                    get { return _id; }
                    set { _id = value; }
                }
            }
            #endregion
        }
    }
    === ASCX.CS: END ===
    ### Navigation Control: END ###


    ### ACTUAL PAGE: START ###
    === ASPX: START ===

    <%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="AJAXEnabledWebApplication1._Default" %>

    <%@ Register Src="navigation.ascx" TagName="Navigation" TagPrefix="navigationUC" %>
    <%--<%@ Register Src="~/layouts/_controltemplates/navigation.ascx" TagName="Navigation" TagPrefix="navigationUC" %>--%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <div>
                        <table style="width: 100%; height=100%">
                            <tr>
                                <td>
                                    <navigationUC:Navigation runat="server" ID="navigationUC1"></navigationUC:Navigation>
                                </td>
                            </tr>
                            <tr>
                                <td height="100%">
                                    <asp:ListBox runat="server" ID="listBox" Height="400px"></asp:ListBox>
                                </td>
                            </tr>
                        </table>
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
        </form>
    </body>
    </html>
    === ASPX: END===

    === ASPX.CS: START===

    namespace AJAXEnabledWebApplication1
    {
        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
            }

            protected override void OnInit(EventArgs e)
            {
                navigationUC1.OnItemClick += navigationUC1_OnItemClick;
            }

            private void navigationUC1_OnItemClick(object sender, navigation.NavigationEventArgs e)
            {
                listBox.Items.Add(e.Id);
            }
        }
    }
    === ASPX.CS: END ===
    ### ACTUAL PAGE: END ###

  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 09 Dec 2008 Link to this post

    Hi juan,

    SharePoint is notorious for having problems with ASP.NET Ajax. Make sure you have the latest service pack installed. Also check this blog post by the SharePoint team.

    Regards,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. juan
    juan avatar
    10 posts
    Member since:
    Dec 2008

    Posted 11 Dec 2008 Link to this post

    Hi Albert,

    Yes, I think so too that SharePoint - ajax giving me/us alot of headache. Some simple code will work on a none SharePoint environment but when we/i try to implement it on SharePoint, errors keeps popping up.

    Going back to the topic. Yes, we've installed the latest service pack. I believe that we've configured things properly since other telerik ajax controls are working properly. Is there any sample application/code snippets where in that the radpanel was used and the page is not actually refreshing/postback?

    Thanks Guys.

    Regards,
    Juan
  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 12 Dec 2008 Link to this post

    Hello juan,

    We don't have such a sample application. You can first try achieving the ajax capabilities with a simple link button. When it works RadPanelBar will stop posting back as well.

    Regards,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. juan
    juan avatar
    10 posts
    Member since:
    Dec 2008

    Posted 12 Dec 2008 Link to this post

    Hi Albert,

    Yes, that is exactly what is happening right now. I will need to click something else before the radpanel will stop posting back. But, the thing is, I cannot do it like that. I need to find a way on how to make radpanel to stop the postback for the first time. I just need to know if I can do it with RadPanelBar using SharePoint. Thanks for the time.

    Regards,
    Juan
  7. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 12 Dec 2008 Link to this post

    Hi juan,

    I couldn't understand from your reply whether a link button works as expected in your scenario. Could you please confirm this? Does clicking on a link button cause ajax requests instead of postback?

    Regards,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. juan
    juan avatar
    10 posts
    Member since:
    Dec 2008

    Posted 12 Dec 2008 Link to this post

    Hi Albert,

    I'm amazed with your prompt reply.

    Actually it is not a link, one of the guys has some links on the main page.

    When Rad Panel was clicked first. Page will be refreshed.
    When I click a link (actually this is from different user control) it will fire the ajax. Page will not refresh.
    When click the Rad Panel again, it will fire the ajax. Page will not refresh. <-- I'm hoping for this result for the first time.

    Thanks and Regards,
    Juan
  9. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 12 Dec 2008 Link to this post

    Hello juan,

    What happens when you first click the link instead of the panelbar? I believe the problem is not in RadPAnelBar but in ASP.NET Ajax. Did you override the spOriginalFormAction as described in the blog post I've sent you earlier?

    Regards,
    Albert
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  10. juan
    juan avatar
    10 posts
    Member since:
    Dec 2008

    Posted 18 Jan 2009 Link to this post

    Hi Albert,

    One of the guys already solved the problem. I'll post it here on how they've solved it. Thanks for your replies.

    Regards,
    Juan
  11. mathieu cupryk
    mathieu cupryk avatar
    27 posts
    Member since:
    Jul 2009

    Posted 26 Nov 2009 Link to this post

    Can you email me the rad panel bar solution
    I am stuck.
    mathieu_cupryk@hotmail.com
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017