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

javascript ajaxRequest call to server side, set editor content but does render in gui.

2 Answers 83 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 23 Mar 2011, 11:48 PM

Description of Application:
Application page has a radlistbox on one pane on page and a radeditor on other pane on same page.  When user clicks on a list box item the radeditor is saved and different content is loaded into radeditor depending on item selected in radlistbox. 

Configuration of Application:
Application has a site.master which resides the radajaxmanager.  The problem occurrs in a conent page

Description of Problem:
Radeditor does not change when set server side as a result of a client side ajax request.

Description of events:
I catch the radlistbox change client side on a selection_changed event and send an ajax message to server (

 

 

radManager.ajaxRequest(PassedArgument) )

 

 along with a unique identifier indicating what the new radlistbox item that was selected.

Ajax message from javascript is caught server side (RadAjax_AjaxRequest) side with no problem.  Editor is tested for "dirtyness", saved if it is dirty.  Then the editor content is set according to the value selected in the radlistbox.  Again no problem, and server side I can see that editor.content has changed in the debugger.  The problem is the editor does not change in the gui.  If I make a responseScripts call to get the value client side (editor.get_html();) it is still set to it's old value.

Code Snippets:
Site.Master

 

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
  
onajaxrequest="RadAjaxManager1_AjaxRequest_SiteMaster">

 

 

 

</telerik:RadAjaxManager>

 

Content Page, code behind, page load

protected void Page_Load(object sender, EventArgs e)   {
...
     RadAjaxManager manager = RadAjaxManager.GetCurrent(this);
     manager.AjaxRequest +=  new 
         RadAjaxControl.AjaxRequestDelegate(RadAjaxManager_AjaxRequest_Editor);
...
}

Content Page, client side, listbox selection change
function RadListBox_ManualList_OnCleintSelectedIndexChanged(sender, args)
{
    ...
    SendAjaxMessage("RadListBoxSelectionChanged-" + item.get_value());
}

Content Page, server side, catch ajax message
public void RadAjaxManager_AjaxRequest_Editor(object sender, AjaxRequestEventArgs e)
{
    ...
   /* 
    * force rad edior content change for test
    */
    RadEditor1.Content = "hello world";
  
     string MyScript = "test();";
     RadAjaxManager.GetCurrent(this).ResponseScripts.Add(MyScript);
        }

Content Page, client side, test()
function test(){
    editor = $find("<%=RadEditor1.ClientID %>");
    var test = editor.get_html();
    //debugger here would show content not changed, also visable in gui
};

2 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 28 Mar 2011, 08:08 PM
Resovled, please disregard.
0
Vinoth Arun
Top achievements
Rank 2
answered on 30 Jun 2011, 11:52 AM
Hi,

Are u got the solution, I need the solution, please let me know about it.
Tags
Ajax
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Vinoth Arun
Top achievements
Rank 2
Share this question
or