PDA

View Full Version : About cuteeditor



Huangshan
Oct 26, 2009, 5:47 AM
Hi, I have a Cuteeditor in my project like




    <CE:Editor ID="edtContent" runat="server" AutoConfigure="Simple" Width="750" Height="430"
ResizeMode="None" ThemeType="Office2007" BreakElement="Br" FilesPath="../CuteSoft_Client/CuteEditor/"
EditorWysiwygModeCss="../Css/example.css">
</CE:Editor>




and I wanna assign some value for it , and I do it like this:




    protected void OnClick(object sender, AjaxEventArgs e)
{
       edtContent.Text="My Text Value...";
}




but when I click the button, it's still blank there in the Editor......:(




wish some one can help, thank your very much!!




PSD:I used the ExtButton, and I don't want to use aspbutton.




huangshan

10, 26, 2009

jchau
Oct 26, 2009, 11:09 AM
You can not update non-coolite controls during an AjaxEvent/AjaxMethod.

geoffrey.mcgill
Oct 26, 2009, 3:13 PM
Hi Huangshan,

As mentioned by @jchau, non-coolite controls can not be directly updated during an AjaxEvent, although you can send back a small piece of JavaScript which can be executed on the client to update the control.

All you would need to know is what JavaScript is required on the client to update the CuteEditor. Then use the .AddScript Method to configure the response.

Example (not tested, just theoretical)


this.Button1.AddScript("{0}.setText(\"{1}\")", this.edtContent.ClientID, "My Text Value...");

Hope this helps.

Huangshan
Oct 26, 2009, 10:32 PM
Thank you geoffrey.mcgill! I'll try with JavaScript, thank you for your help 

Huangshan
Oct 28, 2009, 2:27 AM
Hi!  geoffrey.mcgill,

This can set some content  into the editor at client side:


<script language="JavaScript" type="text/javascript"> 
function setHTML()
{
// get the cute editor instance
var editor1 = &#100;ocument.getElementById('<%=Editor1.ClientID%>');
// Set the editor
editor1.setHTML("My text...");
}
</script>




But I tried to do this at server side.....

and I want put some variable into the editor, hope you can help, thanx!




PSD:

 
this.Button1.AddScript("{0}.setText(\"{1}\")", this.edtContent.ClientID, "My Text Value..."); does not work fine...:(

Vladimir
Oct 28, 2009, 7:41 AM
Hi,

If tested and ensure that setHTML works fine for CuteEditor then use setHTML instead setText



this.Button1.AddScript("{0}.setHTML('{1}')", this.Editor1.ClientID, "My Text Value...");

Huangshan
Oct 28, 2009, 10:39 PM
Thank you vladimir!

it's  resolved! thank you for all your help!