This is a migrated thread and some comments may be shown as answers.
RadGrid Data in RadEditor
6 Answers 65 Views
This is a migrated thread and some comments may be shown as answers.
Simón
Top achievements
Rank 1
Simón asked on 03 Apr 2009, 08:21 PM
Hi,
I want to use the RadGrid data as the content of the RadEditor, but I have no idea how to do this, or if this is possible. Any idea how to do this?
Thanks in advance,
Simón de Lizarza

6 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 06 Apr 2009, 02:02 PM
Hi Simón,

RadEditor is just an enhanced TextBox control and you can implement it in RadGrid as you will do this with a standard asp:textbox control. You can get or set HTML content in the editor via its Content property.

You can see the following KB article for more information: http://www.telerik.com/support/kb/aspnet-ajax/grid/using-radeditor-as-editor-in-template-column-of-radgrid.aspx

Best regards,
Rumen
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Simón
Top achievements
Rank 1
answered on 06 Apr 2009, 02:15 PM
Hi,
What I want is to set the HTML content of the RadEditor using the data and the table of the RadGrid as part of the content. Is there any way I can get the table and data inside the RadGrid as an HTML to use as part of the RadEditor content?

Thanks,
Simón de Lizarza
0
Rumen
Telerik team
answered on 09 Apr 2009, 02:21 PM
Hi Simón,

This is a very unusual request and it is not supported out-of-the box. Here is one possible solution:

ASPX:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title>Untitled Page</title> 
     
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
    <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
        <telerik:RadGrid ID="RadGrid1" runat="server" ></telerik:RadGrid> 
        <br /> 
        <telerik:RadEditor  
                   
        ID="RadEditor1" OnClientLoad="OnClientLoad" runat="server" ></telerik:RadEditor> 
        
        <script type="text/javascript"
        function OnClientLoad(editor) 
        { 
            var grid = $find('<%= RadGrid1.ClientID %>').get_element().cloneNode(true);             
            var div = document.createElement("DIV"); 
            div.appendChild(grid);             
            editor.set_html(div.innerHTML); 
        } 
        </script> 
    </div> 
    </form> 
</body> 
</html> 
 

Codebehind:
using System; 
using System.Data; 
using System.Configuration; 
using System.Collections; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Web.UI.HtmlControls; 
using System.IO; 
 
public partial class Default2 : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        RadGrid1.DataSource = new int[] { 0, 1, 2, 3 }; 
        string css = ClientScript.GetWebResourceUrl(RadGrid1.GetType(), String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css", RadGrid1.Skin)); 
        RadEditor1.CssFiles.Add(css); 
    } 

If needed you can put the grid control in a hidden div element and display only RadEditor on the page.

Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Thangavelu
Top achievements
Rank 1
answered on 11 Aug 2009, 09:26 AM
Dear All,

I am trying to get the client ID of the RADEditor Control that is part of a webpart on the page.{using Javascript}

As recommended by Telerik, Here is the code that i am using.

var editor = $find("<%=Main._______.EditFrmTemplate.RadEditorCtrl.ClientID%>");

where as:
[Main] - reference to my webpart zone ID
________ - want to fill with my webpart ID!!!
[EditFrmTemplate] - reference to my edit form template

I am not sure what is the way to fill-in the __________;
I want to refer to my webpart which is having a web part ID such as f_c76717b6_u61a_4g1a_9dbd_855493e2fc76;

Any help on this would be of great help.

Thanks in advance for you folks.
0
Thangavelu
Top achievements
Rank 1
answered on 12 Aug 2009, 06:33 AM
It would be helpful if someone can help on the above query. Thanks in advance.

Regards,
Velu
0
Tervel
Telerik team
answered on 12 Aug 2009, 08:12 AM
Hi Thangavelu,

One very straightforward way to get the client ID of the editor if it is nested deep in a user control is to use its OnClientLoad event to assign whatever value you need to a global variable, which you can access later, e.g.
<telerik:RadEditor  ID="RadEditor1" OnClientLoad="OnClientLoad" runat="server" ></telerik:RadEditor>
       
        <script type="text/javascript">
var globalEditorID = null;

        function OnClientLoad(editor)
        {
              globalEditorID = editor.get_id();
        }
        </script>

Regards,
Tervel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Asked by
Simón
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Simón
Top achievements
Rank 1
Thangavelu
Top achievements
Rank 1
Tervel
Telerik team
Share this question
or