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:
I have the button which tries to get the render html for this page but it unfortunately fails.
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
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