locked
Exporting Ajax Chart Control to Excel RRS feed

  • Question

  • User1853342071 posted

    hi, friends,

    I am using Asp.net Ajax Chart Control.

    it is nice and simple to use, and also easier to manage than normal asp.net chart control.

    but I got error when I try to export Ajax chart to excel.

    the error is :

    Script control 'BarChart1' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
    Parameter name: scriptControl

    my Ajax Chart id is BarChart1.

    I don't know how to register ScriptControl().

    in my codebehind, I already wrote already to export GridView.

    public override void VerifyRenderingInServerForm(Control control)
        {
            //base.VerifyRenderingInServerForm(control);
            //ScriptManager sm = ScriptManager.GetCurrent(Page);
            //sm.RegisterScriptControl(BarChart1);
        }

    I believe this error is what other peoples also have encountered before.

    but I still cannot find the solution yet.

    regards

    Monday, August 25, 2014 2:36 AM

Answers

  • User555306248 posted

    You should take care of two things..

    - If you are overriding OnPreRender event, please make sure that your overridden event contains a call to base.OnPreRender too..

    - If you are using Master Page, Place the ScriptManager control on the master page if you have placed it on page.

    If doing the above does not solve the problem, you can call "EnsureChildControls()", before the OnPreRender event.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 28, 2014 12:03 AM

All replies

  • User-417640953 posted

    Script control 'BarChart1' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
    Parameter name: scriptControl

    Hi skko,

    Thanks for your post.

    For this issue, I think you can use below code to register the Ajax chart control.

      protected void Page_Load(object sender, EventArgs e)
            {
                ScriptManager sm = ScriptManager.GetCurrent(Page);
                sm.RegisterScriptControl(control_name);
            }

    If any doubt, please feel free to back. Thanks.

    Best Regards!

    Tuesday, August 26, 2014 6:55 AM
  • User1853342071 posted

    thanks for your reply, Fuxiang Zhan,..

    once I got your reply, I added c# code in the page_load as you suggested.

    I got another error. the following error come out.

    "Script controls may not be registered before PreRender."

    regards

    Tuesday, August 26, 2014 9:23 PM
  • Wednesday, August 27, 2014 10:33 PM
  • User555306248 posted

    You should take care of two things..

    - If you are overriding OnPreRender event, please make sure that your overridden event contains a call to base.OnPreRender too..

    - If you are using Master Page, Place the ScriptManager control on the master page if you have placed it on page.

    If doing the above does not solve the problem, you can call "EnsureChildControls()", before the OnPreRender event.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 28, 2014 12:03 AM