3

I cannot get this to work, here is code that I found in another thread but it is not working for me, I'm getting "set_content is not a function" :

$find("<%=Hee.ClientID%>").set_content("whatever");

Is this still valid? I also tried to set value of the textbox it extends, tried setting InnerHtml of both,none worked.

Diego
  • 18,035
  • 5
  • 62
  • 66
formatc
  • 4,261
  • 7
  • 43
  • 81

4 Answers4

2

I was going nuts for hours looking for a way to change the content and here's what I've come up with that works quite well:

This is the TextBox and Extender:

<asp:Textbox ID="replyBody" Height="450px" Width="892px" runat="server" TextMode ="MultiLine"  />
<ajaxToolkit:HtmlEditorExtender ID="replyBody_HtmlEditorExtender" runat="server" Enabled="True" EnableSanitization="false" TargetControlID="replyBody">
</ajaxToolkit:HtmlEditorExtender> 

Now this is the javascript that changed the value:

<script type = "text/javascript" >
    function changeText(someString){
        document.getElementById('ctl00_ContentPlaceHolder1_replyBody_HtmlEditorExtender_ExtenderContentEditable').innerHTML = someString; 
    }
</script>

This works like a charm. The above element ID is actually that of a div, however changing its contents updates the replyBody.Text property

Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107
iuppiter
  • 315
  • 3
  • 9
  • What is the object with id `ctl00_ContentPlaceHolder1_replyBody_HtmlEditorExtender_ExtenderContentEditable` and how do you determine the ClientID at run time? Thanks. – Old Geezer Jan 10 '13 at 02:03
1
$find("<%= Hee.ClientID %>")._editableDiv.innerHTML = "whatever";
Yuriy Rozhovetskiy
  • 22,270
  • 4
  • 37
  • 68
  • Thanks for replay,I dropped HEE althogether because it's broken too much: size problem, auto-focus...etc. I replaced it with tiny MCE. But I guess this could work, I tried something smilar before like: $find("<%= editableDiv.ClientID %>").innerHTML = "whatever"; But that didn't work. – formatc Mar 24 '12 at 09:18
  • if you drop the find and do instead $("id").innerHTML = "it works"; – dmportella Mar 24 '12 at 19:15
0

Try this:

$("#<%=Hee.ClientID%>").html("whatever");
Diego
  • 18,035
  • 5
  • 62
  • 66
0

You could try this out:

var ctrl = $get("<%=Hee.ClientID%>").control;
ctrl.set_content("whatever");
Krishna
  • 636
  • 3
  • 8