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

[Solved] Add data from RadGrid to RadEditor

2 Answers 146 Views
Editor
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 12 Jan 2010, 07:50 PM
Hi all:

I have an ASP.NET application with several RadGrids on it displaying data, as well as some other text and images. All of the content is contained within an ASP.NET Ajax tabcontainer. The end user wants the ability to export all of the data to a PDF file, so I thought it might be a good idea to put a RadEditor on another tab, and have all of the data from the application added to the RadEditor content area, and then when the end user is ready they can make any needed changes in the RadEditor, and then use the ExportToPDF function to get the PDF.

However, I have been unable to get the data from the RadGrids into the RadEditor, can anyone give me some insight as to how I can accomplish this? I tried this:

public string RenderControl(Control ctrl)

  {

    StringBuilder sb = new StringBuilder();

    StringWriter tw = new StringWriter(sb);

    HtmlTextWriter hw = new HtmlTextWriter(tw);

 

    ctrl.RenderControl(hw);

    return sb.ToString();

  }

protected void Button1_Click1(object sender, EventArgs e)

  {

    RadEditor1.Content += RenderControl(RadGrid1);
    RadEditor1.ExportToPdf();
  }

But I got some kind of script error:

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

Any and all input is greatly appreciated.

John.

2 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 13 Jan 2010, 05:54 PM
This seems like more of a general Ajax issue and not necessarily your implementation of  getting and setting the content for the RadEditor. Are you attempting to Ajaxify the RadGrid in any way? I believe if you are using a RadAjaxManager there might be something going on within its setup that causes the issue. If you are indeed using an AjaxManager try to comment it out and see if you are receiving the same error.
0
John
Top achievements
Rank 1
answered on 13 Jan 2010, 07:57 PM
Hi:

Thanks for the note. Yes I think there is an ajaxmanager (I am not in front of the page right now) as the application has 6 tabs and 4 of those tabs have grids on them. I found that in order to enalbe paging on teh individual grids they each needed to be inside thier own update panels...I'll try your suggestion.

John.
Tags
Editor
Asked by
John
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
John
Top achievements
Rank 1
Share this question
or