RADPanelBar and ScriptManager

4 posts, 0 answers
  1. Muhammad
    Muhammad avatar
    2 posts
    Member since:
    Aug 2020

    Posted 07 Sep Link to this post

    Hi,

    We are working on a RadPanelBar upgrade initiative. We are currently using RadPanelbar.Net2 (v2.0.50727) and want to upgrade it to the latest version (Latest Version is 2020.2.617).

    The problem we are facing at the moment is:

    - RadPanelBar requires Script Manager added to the page. In our implementation RadPanelBar is added to Master Page and so it requires a form tag having Script Manager on it.
    - Some of the child pages in our case don't have form on them but there are instances where Child pages do have form on them. So, in these cases application stops working because the child page form becomes nested.
    - We tried to resolve nested form issue by dynamically creating Form from Code-behind but it is not working as per expectations.

    Is there any possibility to use RadPanelBar without Script Manager - this way it will become the save as of v2.0.50727?
  2. Peter Milchev
    Admin
    Peter Milchev avatar
    859 posts

    Posted 07 Sep Link to this post

    Hello Muhammad,

    The RadPanelBar, as all script controls in the MS AJAX framework require a ScriptManager. Also, the Web Forms framework itself relies on a main form element that is used to postback the data between the client and server. 

    Nevertheless, all Telerik controls have the RegisterWithScriptManager property which when set to false, will render the needed script elements directly in the response. Keep in mind that in case you do not have a ScriptManager on the page, you need to manually register the needed scripts for the MS AJAX framework itself.

     /// <summary>
            /// Gets or sets the value, indicating whether to register with the ScriptManager control on the page.
            /// </summary>
            /// <remarks>
            /// <para>
            /// If RegisterWithScriptManager is set to false the control can be rendered on the page using Web Services or normal callback requests/page methods.
            /// </para>
            /// </remarks>
            [Description("Whether to register with the ScriptManager control on the page")]
            [DefaultValue(true)]
            [Category(PropertyCategory.Behavior)]
            public virtual bool RegisterWithScriptManager
            {
                get { return (bool) (ViewState["RegisterWithScriptManager"] ?? true); }
                set { ViewState["RegisterWithScriptManager"] = value; }
            }

    About the migration between the classic RadControls to the new controls for UI for ASP.NET AJAX, you can check the following article:

    Let us know if you have any further questions.

    Regards,
    Peter Milchev
    Progress Telerik

    Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

  3. Muhammad
    Muhammad avatar
    2 posts
    Member since:
    Aug 2020

    Posted 10 Sep in reply to Peter Milchev Link to this post

    My scenario is little different.

     I am facing two below given issue,

    #1

     I have content pages that already contains server-side form tags and many other pages that has no server-side form tag.
     If I add a new server-side form tag in master page and add script manager then it will conflict with all pages that have already server-side form tag because there should be only one server-side form tag in a page.

    #2

      If I add server-side form tag with script manager in every asp.net web form, then what about MVC pages?
    Currently there is no control that supports both asp.net web forms and asp.net MVC.

    Is there any possibility to use RadPanelBar without Script Manager - this way it will become the save as of v2.0.50727???

  4. Peter Milchev
    Admin
    Peter Milchev avatar
    859 posts

    Posted 15 Sep Link to this post

    Hello Muhammad,

    As I have mentioned earlier, the PanelBar would be able to work without a ScriptManager as long as you register the required scripts, e.g. MicrosoftAjax.js and MicrosoftAjaxWebForms.js.

    I have tested the following simple markup that allowed the client-side object of the PanelBar to be properly initialized and the expand/collapse to work as expected. Keep in mind that ajax.js is a sample file where I pasted the content of MicrosoftAjax.js and MicrosoftAjaxWebForms.js

    <%@ Page %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <script src="ajax.js"></script>
        <telerik:RadPanelBar RegisterWithScriptManager="false" runat="server">
            <Items>
                <telerik:RadPanelItem Text="Root 1">
                    <Items>
                        <telerik:RadPanelItem Text="Child 1"></telerik:RadPanelItem>
                        <telerik:RadPanelItem Text="Child 2"></telerik:RadPanelItem>
                    </Items>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Root 2"></telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelBar>
    </body>
    </html>

    If you are using MVC, I would like to focus your attention to Telerik UI for ASP.NET MVC that is designed specifically for this framework

    Another product you might be interested in is the Kendo UI for jQuery library that contains entirely client-side widgets which does not depend at all on the server framework:

    Regards,
    Peter Milchev
    Progress Telerik

    Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

Back to Top