Creating a RadScriptManager in cs

3 posts, 0 answers
  1. Yoongu
    Yoongu avatar
    16 posts
    Member since:
    Sep 2014

    Posted 15 Oct 2014 Link to this post


    I have a question about RadScriptManager.

    When I create a RadScriptManager to use the RadAjaxManager,
    This works well if generated directly from the "aspx". 

    aspx :
        <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
                <telerik:AjaxSetting AjaxControlID="RadButton1">
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelCssClass="" />
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
        <telerik:RadButton ID="RadButton1" runat="server" OnClick="RadButton1_Click" Text="RadButton">
        <asp:Panel ID="Panel1" runat="server">
            <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" Culture="ko-KR" Skin="Metro">
                <MasterTableView ClientDataKeyNames="itemcd" AllowAutomaticDeletes="False" AllowAutomaticInserts="False" AllowAutomaticUpdates="False" AutoGenerateColumns="False" DataKeyNames="itemcd" EditMode="Batch">
                        <telerik:GridBoundColumn DataField="itemcd" FilterControlAltText="Filter itemcd column" HeaderText="품목코드" ReadOnly="True" SortExpression="itemcd" UniqueName="itemcd">
        <ModelErrorMessage Text=""></ModelErrorMessage>
                        <telerik:GridBoundColumn DataField="itemnm" FilterControlAltText="Filter itemnm column" HeaderText="itemnm" SortExpression="itemnm" UniqueName="itemnm">
        <ModelErrorMessage Text=""></ModelErrorMessage>
                        <telerik:GridBoundColumn DataField="size" FilterControlAltText="Filter size column" HeaderText="size" SortExpression="size" UniqueName="size">
        <ModelErrorMessage Text=""></ModelErrorMessage>
                <ClientSettings AllowKeyboardNavigation="true">
                    <Selecting CellSelectionMode="MultiColumn"></Selecting>
                    <ClientEvents OnCellSelected="RadGrid1_OnCellSelected" OnCellDeselecting="RadGrid1_OnCellDeselecting" OnBatchEditCellValueChanging="RadGrid1_OnBatchEditCellValueChanging" />
        <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:DaeMyungDB %>"
            SelectCommand="SELECT top 1000 itemcd, itemnm, size FROM biitm01t"

    However, I had to remove RadScriptManager from the aspx.
    Then, When I add in cs this, RadAjaxManager does not work.

            protected void Page_Load(object sender, EventArgs e)
                RadScriptManager scriptManager = new RadScriptManager();
            protected void RadButton1_Click(object sender, EventArgs e)

    What did I do wrong?


  2. Radoslav
    Radoslav avatar
    1564 posts

    Posted 17 Oct 2014 Link to this post

    Hello Yoongu,

    Thank you for contacting us.

    To achieve the desired functionality you need to use following code snippet:
    protected RadScriptManager theManager;
        protected override void OnPreInit(EventArgs e)
            theManager = new RadScriptManager();
            Page.Items[typeof(ScriptManager)] = theManager;
        protected override void OnLoad(EventArgs e)
            Page.Items[typeof(ScriptManager)] = null;
            this.Form.Controls.AddAt(0, theManager);

    Additionally I am sending you a simple example. Please check it out and let me know if it helps you.

    If you need further assistance, do not hesitate to contact us again.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
  4. Yoongu
    Yoongu avatar
    16 posts
    Member since:
    Sep 2014

    Posted 19 Oct 2014 in reply to Radoslav Link to this post

    Hi Radoslav,

    Your answer was very helpful for me.

    Thank you!
Back to Top