WebTextEditor - Value in TextEditor Section

1 reply. Last post: March 18, 2011 2:41 AM by Yudi
Tags :

Hello,

I have a WebGrid cell containing data made up of text and html markup (tags, urls, links, images, etc) from a sql database table.

When I use WebTextEditor as custom editor in WebGrid, everything in the grid cell, including html and images, is returned in the editor (see image 1).  But when I copy the grid cell content in a section of a standalone WebTextEditor, only plain text is copied from the grid to the editor section (see image 2), because the client side method used only calls for Text.

How can I modify this code to copy everything (text and html markup) from the grid cell to the editor, so that I can use WebtextEditor interchangeably in custom editor in Webgrid or standalone modes to edit the same data?  

Regards,

Jean

        function doSomething () {

            var grid = ISGetObject("WebGrid1");

            var rte = ISGetObject("textEditor");

            var selectedObject = grid.GetSelectedObject           

            if (selectedObject != null) {

                var selectedRow = selectedObject.ToRowObject();

                var cells = selectedRow.GetCells();

                rte.SetValue(cells.GetNamedItem("GridCellName").Text, "EditorSectionName");

            }

            returntrue;

        }

All Replies

Yudi Member

Please allow me to offer you another technique for your specific scenario.

I think it would be better to get the value of innerHtml instead of the value of Text property from the cell. I made a minor modification on your JavaScript function based on your requirement. Please kindly test the modified version of this JavaScript function and let us know whether it helps or not.

function DoSomething() {
    var grid = ISGetObject("WebGrid1");
    var rte = ISGetObject("WebTextEditor1");
    var selectedObj = grid.GetSelectedObject();

    if (selectedObj != null) {
        var selectedRow = selectedObj.ToRowObject();
        var cells = selectedRow.GetCells();

        rte.SetValue(cells.GetNamedItem("ProductDetails").GetElement().innerHTML);
    }
            
    return true;
}
All times are GMT -5. The time now is 6:56 AM.
Previous Next