This is a migrated thread and some comments may be shown as answers.

Scriptmanager error while using RenderControl

1 Answer 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kishan Gandikota
Top achievements
Rank 1
Kishan Gandikota asked on 28 Nov 2011, 12:35 PM
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

1 Answer, 1 is accepted

Sort by
0
Kishan Gandikota
Top achievements
Rank 1
answered on 08 Dec 2011, 07:03 PM
Hi Telerik Team,

Can you please put your thoughts on this issue?

Regards,
Kishan G K
Tags
Grid
Asked by
Kishan Gandikota
Top achievements
Rank 1
Answers by
Kishan Gandikota
Top achievements
Rank 1
Share this question
or