RadGrid Data in RadEditor

7 posts, 0 answers
  1. Simón
    Simón avatar
    21 posts
    Member since:
    Dec 2008

    Posted 03 Apr 2009 Link to this post

    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
  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 06 Apr 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Simón
    Simón avatar
    21 posts
    Member since:
    Dec 2008

    Posted 06 Apr 2009 Link to this post

    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
  5. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 09 Apr 2009 Link to this post

    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.
  6. Thangavelu
    Thangavelu avatar
    2 posts
    Member since:
    Jun 2009

    Posted 11 Aug 2009 Link to this post

    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.
  7. Thangavelu
    Thangavelu avatar
    2 posts
    Member since:
    Jun 2009

    Posted 12 Aug 2009 Link to this post

    It would be helpful if someone can help on the above query. Thanks in advance.

    Regards,
    Velu
  8. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 12 Aug 2009 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017