Scriptmanager error while using RenderControl

2 posts, 0 answers
  1. Kishan Gandikota
    Kishan Gandikota avatar
    44 posts
    Member since:
    Sep 2009

    Posted 28 Nov 2011 Link to this post

    Hi,

    I have a asp .net page which has RadGrid inside the page. My objective is: on click of a button on the page, i need to get the rendered html of the radgrid so that i can do more processing (for printing/taking screenshots of the grid alone).

    Grid:
    <telerik:RadGrid ID="grid1" ShowFooter="true"
                OnNeedDataSource="grid1_NeedDataSource" ShowStatusBar="true" runat="server" OnItemDataBound="GridCollateralDataBound"
                AllowFilteringByColumn="false">
                <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" AllowColumnHide="true" ColumnsReorderMethod="Reorder">
                    <Scrolling AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders="false"  />
                </ClientSettings>
                    <Columns>
                          .......

                    </Columns>
            </telerik:RadGrid>

    I have the button which tries to get the render html for this page but it unfortunately fails.

    void ButtonClick(object sender, EventArgs e)
            {              
     
                    System.IO.StringWriter stringWriter = new System.IO.StringWriter();
                    HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
     

     
                    grid1.RenderControl(htmlWriter);
     
                    if (stringWriter != null)
                        stringWriter.Dispose();
                    if (htmlWriter != null)
                        htmlWriter.Dispose();

    Here "grid1.RenderControl" code throws error that "Script control 'rghcMenu' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
    Parameter name: scriptControl".

    I tried setting grid1's RegisterWithScriptManager to false before calling rendercontrol and also tried adding the scriptmanager explicitly for grid1 (added a panel with scriptmanager at run-time and and then grid1 inside). All these options still were still throwing the same error.

    Your help on this is appreciated.

    Note: I am using the latest version of telerik radgrid: 2011.2.915.40

    Regards,
    Kishan G K
  2. Kishan Gandikota
    Kishan Gandikota avatar
    44 posts
    Member since:
    Sep 2009

    Posted 08 Dec 2011 Link to this post

    Hi Telerik Team,

    Can you please put your thoughts on this issue?

    Regards,
    Kishan G K
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top