Hello ,
I am trying to paste an html in radeditor using
<script type="text/javascript">
var editor = $find("<%=RadEditor1.ClientID%>"); //get a reference to RadEditor client object
editor.set_html('test');
</script>
but when i try to find the editor using $find it gives error $find is not defined. plz help.
Regards
maggi
I am trying to paste an html in radeditor using
<script type="text/javascript">
var editor = $find("<%=RadEditor1.ClientID%>"); //get a reference to RadEditor client object
editor.set_html('test');
</script>
but when i try to find the editor using $find it gives error $find is not defined. plz help.
Regards
maggi
10 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 27 May 2009, 09:33 AM
Hi Maggi,
Can you try the following approach by using the pageLoad() method to set the editor content?
JavaScript:
Could you please inform us exactly which version of RadEditor/RadControl are you using (if this does not help)?
Thanks,
Shinu.
Can you try the following approach by using the pageLoad() method to set the editor content?
JavaScript:
<script type="text/javascript"> |
function pageLoad() |
{ |
var editor = $find("<%=RadEditor1.ClientID%>"); //get a reference to RadEditor client object |
editor.set_html('test'); |
} |
</script> |
Thanks,
Shinu.
0
maggi
Top achievements
Rank 1
answered on 30 May 2009, 09:16 AM
Hi Shinu,
I think my version of editor might be the reason this code does not work for me i am using 7.1.0.0 version of the editor. Is there any other way of copying the text in a radeditor from the client side.
Thanks,
maggi
I think my version of editor might be the reason this code does not work for me i am using 7.1.0.0 version of the editor. Is there any other way of copying the text in a radeditor from the client side.
Thanks,
maggi
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 30 May 2009, 02:35 PM
var currentEditor = $find("EditorClientID") - is related to RadEditor for ASP.NET AJAX.
If you want ot get a reference to RadEditor for ASP.NET you should use GetRadEditor method, e.g.
var currentEditor = GetRadEditor("RadEditor1");
currentEditor.SetHtml("text")
0
Netfinity
Top achievements
Rank 1
answered on 16 Jul 2009, 09:50 PM
I am using the following javascript in my Sitefinity site:
protected void Page_Load(object sender, EventArgs e)
{
string script = string.Format(@"<script type='text/javascript' language='javascript'>
$(document).ready(function() {{
var quoteEditor = $find('{0}');
quoteEditor.set_html('');
}});
</script>", tbQuote.ClientID);
Page.ClientScript.RegisterStartupScript(Page.GetType(), "removeQuote", script);
}
The issue is that this works perfectly (as usual) on Firefox but I get a javascript error in IE 7
I am using JQuery throughout my site and I am note sure if this is related. I have already tried GetRadEditor() .SetHtml(), $telerik.$ instead of just $, and I have tried using jQuery.noConflict(). All to no avail.
IE is the bane of my life can someone please provide a work around for this?
protected void Page_Load(object sender, EventArgs e)
{
string script = string.Format(@"<script type='text/javascript' language='javascript'>
$(document).ready(function() {{
var quoteEditor = $find('{0}');
quoteEditor.set_html('');
}});
</script>", tbQuote.ClientID);
Page.ClientScript.RegisterStartupScript(Page.GetType(), "removeQuote", script);
}
The issue is that this works perfectly (as usual) on Firefox but I get a javascript error in IE 7
I am using JQuery throughout my site and I am note sure if this is related. I have already tried GetRadEditor() .SetHtml(), $telerik.$ instead of just $, and I have tried using jQuery.noConflict(). All to no avail.
IE is the bane of my life can someone please provide a work around for this?
0
Hello Netfinity,
How, and where exactly do you place this code? Are you creating a code behind of some of the existing forum controls/views?
Is it an option for you to change the RadEditor text from the Server side? You can do this by creating a custom control inheriting from the one having the editor, and then find the editor by using base.FindControl(). The custom control class should be placed in the App_Code directory and registered in Sitefinity as follows:
I hope this helps.
Regards,
Georgi
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.
How, and where exactly do you place this code? Are you creating a code behind of some of the existing forum controls/views?
Is it an option for you to change the RadEditor text from the Server side? You can do this by creating a custom control inheriting from the one having the editor, and then find the editor by using base.FindControl(). The custom control class should be placed in the App_Code directory and registered in Sitefinity as follows:
<toolboxControls> |
.. |
<add name="Custom Forum Thread" section="Forums" type="Namespace.Class, App_Code" /> |
.. |
I hope this helps.
Regards,
Georgi
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
Netfinity
Top achievements
Rank 1
answered on 13 Aug 2009, 02:22 AM
I was trying to execute this code in an added code behind on the /Sitefinity/ControlTemplates/Forums/EditPost.ascx template.
The reason for this is to clear or reset the content in the tbQuote RadEditor which contains the previous post's content. In other words I am trying to completely turn off quotes in my Sitefinity site's forum.
I found a much easier work around which I'll share:
protected void Page_PreRender(object sender, EventArgs e)
{
tbQuote.Content = string.Empty;
}
Yes - I added this server side code instead
The reason for this is to clear or reset the content in the tbQuote RadEditor which contains the previous post's content. In other words I am trying to completely turn off quotes in my Sitefinity site's forum.
I found a much easier work around which I'll share:
protected void Page_PreRender(object sender, EventArgs e)
{
tbQuote.Content = string.Empty;
}
Yes - I added this server side code instead
0
Mahesh
Top achievements
Rank 1
answered on 05 Jun 2014, 05:41 AM
GetRadEditor is not working in IE 11.what will be the problem
0
Shinu
Top achievements
Rank 2
answered on 05 Jun 2014, 07:04 AM
Hi Mahesh,
I guess you want to access the RadEditor in JavaScript. Please try the below approach which works fine at my end.
JavaScript:
Please elaborate your requirement if it doesn't help.
Thanks,
Shinu.
I guess you want to access the RadEditor in JavaScript. Please try the below approach which works fine at my end.
JavaScript:
var
currentEditor = $find(
"<%=RadEditor1.ClientID%>"
);
Please elaborate your requirement if it doesn't help.
Thanks,
Shinu.
0
Sujay
Top achievements
Rank 1
answered on 14 Apr 2016, 05:45 PM
Hey,
$find doesn't work outside a function . I was having same problem you had.
0
Hi Sujay,
You can access IScriptControls such as ours at earliest in the Sys.Application.Load event. You can read more on the subject in the following help article that explains the different ways to get a client-side reference to our controls: http://docs.telerik.com/devtools/aspnet-ajax/general-information/get-client-side-reference.
Regards,
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.