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

[Solved] Radeditor content not updating

2 Answers 356 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 16 Jul 2009, 06:06 PM

 

I can't seem to get the content of a RadEditor2 control to update after the following code is ran.
However the ClickedNodeLabel.Text (an ASP Label control) updates just fine.

protected
void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)

{

 

//Use the Deserialize method to create a RadTreeNode object from the JSON string representing the node

 

 

 

 

RadTreeNode clickedNode = new JavaScriptSerializer().Deserialize<RadTreeNode>(e.Argument);

 

 

RadEditor2.Content = clickedNode.Text;

ClickedNodeLabel.Text = clickedNode.Text;

}
Thank you for your help.
-Dan
here's the client side code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultTV.aspx.cs" Inherits="Pages_DefaultTV" %>

<%

 

@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<%

 

@ Register Assembly="RichTextEditor" Namespace="AjaxControls" TagPrefix="cc3" %>

<%

 

@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> 

 

<!

 

 

 

 

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

 

 

 <

 

html xmlns="http://www.w3.org/1999/xhtml">

 

 

 <

 

head id="Head1" runat="server">

 

 

 

 

<link href="Site.css" rel="stylesheet" type="text/css" />

 

 

 

 

<style type="text/css">

 

 

 

 

 

span#total,

 

 

 

#ClickedNodeLabelPanel

 

{

 

display: inline !important;

 

 

 

font-style:italic;

 

}

 

.RadTreeView { border: 1px solid #CBE7F5; }

 

 

#ConfiguratorPanel1 ul

 

 

{

 

margin:0;

 

 

padding:0;

 

 

list-style:none;

}

 

#ConfiguratorPanel1 li

 

{

 

line-height: 28px;

 

}

 

#ConfiguratorPanel1 li label

 

{

 

padding: 0 7px;

 

}

 

</style>

 

 

</

 

 

head>

 

<

 

 

body>

 

 

 

<form runat="server" id="Form1" method="post">

 

 

 

<telerik:RadScriptManager runat="server" ID="RadScriptManager1" />

 

 

 

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest">

 

 

 

<AjaxSettings>

 

 

 

<telerik:AjaxSetting AjaxControlID="RadAjaxManager1">

 

 

<UpdatedControls>

 

 

 

<telerik:AjaxUpdatedControl ControlID="ClickedNodeLabel" />

 

 

 

</UpdatedControls>

 

 

 

 

</telerik:AjaxSetting>

 

 

 

 

</AjaxSettings>

 

 

</telerik:RadAjaxManager>

 

 

<ul>

 

 

<li style="width:300px;border:none;"><label>Load time:</label><span id="Span1">Expand the 'Root Node' to see the load time</span></li>

 

 

 

<li style="width:220px;"><label>Number of nodes to load:</label>

 

 

 

<telerik:RadNumericTextBox runat="server" ID="NodeCountTextBox" Value="1000" MaxValue="4000"

 

 

 

MinValue="100" Width="60px" ShowSpinButtons="True">

 

 

<NumberFormat DecimalDigits="0" />

 

 

</telerik:RadNumericTextBox></li>

 

 

 

<li><label>Clicked node:</label><asp:Label runat="server" ID="ClickedNodeLabel" Text="None" /></li>

 

 

 

<telerik:RadEditor ID="RadEditor2" runat="server" Width="97%">

 

 

 

</telerik:RadEditor></ul>

 

 

<div id="topPane">

 

 

 

<h1>eTariff Editor</h1>

 

 

 

<asp:LinkButton ID="LinkButton1" runat="server" Style="position: absolute; left: 200px;

 

 

 

top: 75px" Width="125px">Open</asp:LinkButton>

 

 

 

<asp:LinkButton ID="LinkButton2" runat="server" Style="position: absolute; left: 250px;

 

 

 

top: 75px" Width="125px">Save</asp:LinkButton>

 

 

 

 

 

<asp:LinkButton ID="LinkButton3" runat="server" Style="position: absolute; left: 300px;

 

 

 

top: 75px" Width="125px">Submit</asp:LinkButton>

 

 

 

</div>

 

 

 

<div id="treePane">

 

 

<div>

 

 

<cc1:DragPanelExtender ID="DragPanelExtender1" runat="server" TargetControlID="Panel1" DragHandleID="RadTreeView1"></cc1:DragPanelExtender>

 

 

 

<cc1:ResizableControlExtender ID="ResizableControlExtender1" runat="server" TargetControlID="Panel2" HandleCssClass="handle" ResizableCssClass="resizing" ></cc1:ResizableControlExtender>

 

 

</div>

 

 

 

 

<asp:Panel ID="Panel1" runat="server" Height="575px" ScrollBars="None" Width="174px">

 

 

 

<asp:Panel ID="Panel2" runat="server" Height="100%" ScrollBars="Both" Width="100%" BackColor="whitesmoke">

 

 

 

 

 

<telerik:RadTreeView ID="RadTreeView1" runat="server" Height="100%" Width="100%"

 

 

 

PersistLoadOnDemandNodes="false" LoadingStatusPosition="BelowNodeText"

 

 

OnClientNodePopulating="nodePopulating" OnClientNodePopulated="nodePopulated"

 

 

 

OnClientNodeCollapsed="nodeCollapsed" OnClientNodeClicked="nodeClicked">

 

 

<WebServiceSettings Path="~/Services/Default.asmx" Method="GetChildNodes" />

 

 

 

</telerik:RadTreeView>

 

 

 

</asp:Panel>

 

 

 

</asp:Panel>

 

 

 

</div>

 

 

 

<div id="editorPane">

 

 

 

<div>

 

 

 

<cc1:DragPanelExtender ID="DragPanelExtender3" runat="server" TargetControlID="Panel3" DragHandleID="Panel4"></cc1:DragPanelExtender>

 

 

 

<cc1:ResizableControlExtender ID="ResizableControlExtender3" runat="server" TargetControlID="Panel3" HandleCssClass="handle" ResizableCssClass="resizing"></cc1:ResizableControlExtender>

 

 

 

</div>

 

 

 

<asp:Panel ID="Panel3" runat="server" Height="600px" ScrollBars="None" Width="800px" >

 

 

 

<asp:Panel ID="Panel4" runat="server" Height="100%" ScrollBars="Both" Width="100%" BackColor="whitesmoke">

 

<%

 

-- <ConfiguratorPanel runat="server" ID="ConfiguratorPanel1" Expanded="true">

 

<cc3:RichTextEditor id="Rte1" Theme="classic" runat="server" Width="97%" Font-Strikeout=true ></cc3:RichTextEditor>

--

 

 

%> <telerik:RadEditor ID="RadEditor1" runat="server" Width="97%">

 

 

 

</telerik:RadEditor>

 

 

 

</asp:Panel>

 

 

 

</asp:Panel>

 

 

 

</div>

 

 

 

<telerik:RadScriptBlock runat="Server" ID="RadScriptBlock1">

 

 

 

<script type="text/javascript">

 

 

 

var startTime;

 

 

 

function nodePopulating(sender, args) {

 

 

 

//Pass the number of nodes to the web service method

 

var input = $find("<%= NodeCountTextBox.ClientID %>");

 

 

 

if (args.get_context())

 

args.get_context().NumberOfNodes = input.get_value();

 

 

//Log the start time

 

startTime =

 

new Date();

 

}

 

 

function nodePopulated(sender, args) {

 

 

 

//Log the end time

 

 

var endTime = new Date();

 

 

 

 

//Display the total time

 

$get(

 

"total").innerHTML = endTime - startTime + "ms";

 

}

 

 

function nodeCollapsed(sender, args) {

 

 

 

//Clear the nodes populated on demand

 

 

 

 

 

 

resetNode(args.get_node());

}

 

 

function resetNode(node) {

 

node.get_nodes().clear();

node.set_expandMode(Telerik.Web.UI.TreeNodeExpandMode.WebService);

}

 

 

function nodeClicked(sender, args) {

 

 

 

var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");

 

 

 

//Send an Ajax request containing the JSON representation of the clicked node. The AjaxRequest will be fired in codebehind.

 

 

 

 

 

 

ajaxManager.ajaxRequest(args.get_node().toJsonString());

}

 

 

</script>

 

 

</telerik:RadScriptBlock>

 

 

</form>

 

</

 

 

body>

 

</

 

 

html>

 

 

 

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 22 Jul 2009, 07:26 AM
Hi Daniel,

In order to update the RadEditor's content on tree node click, you should ajaxify the editor control too. To do that you should set the <telerik:AjaxUpdatedControl ControlID="RadEditor1" /> line in the <UpdatedControls> collection of the RadAjaxManager, e.g.

        <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest"
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadEditor1" /> 
                        <telerik:AjaxUpdatedControl ControlID="ClickedNodeLabel" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 


Sincerely,
Rumen
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.
0
Daniel
Top achievements
Rank 1
answered on 22 Jul 2009, 01:04 PM
thanks.

that worked
Tags
Editor
Asked by
Daniel
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or