<telerik:RadEditor ID="RadEditor1" runat="server" Height="600px" ImageManager-EnableImageEditor="false"
AllowScripts="true" OnClientLoad="InsertText"></telerik:RadEditor>
<asp:Button ID="Button1" runat="server" Text="Image Gallery AJAX" OnClick="Button1_Click"/>
< script type="text/javascript">
function InsertText()
{
var intCPos = GetCursorPosition();
if (intCPos != 0)
{
document.getElementById('hfCPOS').value = intCPos;
}
if(document.getElementById('myValue').value != "")
{
var pos = document.getElementById('hfCPOS').value; //gives 14
var editorr = $find("<%=RadEditor1.ClientID%>"); //get a reference to the editor
var strIMG = document.getElementById('myValue').value; // myvalue = <img id='123' src='123.gif' alt=''/>
var strValue = editorr.get_html(true);
strValue = strValue.substring(0,pos)+ strIMG + strValue.substring(pos)
//editorr.pasteHtml(strValue);
editorr.set_html(strValue);
document.getElementById('myValue).value = "";
document.getElementById('hfCPOS').value = "";
}
}
</script>
o/p (after adding 1st image)
Text Will Come<img alt="" id="parts_coupon_01.jpg" src="http://192.168.3.27:88/Files/Images/2/gallery/Coupons//parts_coupon_01.jpg" runat="server" /> Here.
o/p (after adding 2nd image)
now my cursor is between "Text Will Come Here " - 'e' and 'r' of Here
Text Will Come<im<img id="service_coupon_02.jpg" runat="server" src="http://192.168.3.27:88/Files/Images/2/gallery/Coupons//service_coupon_02.jpg" />g alt="" id="parts_coupon_01.jpg" src="http://192.168.3.27:88/Files/Images/2/gallery/Coupons//parts_coupon_01.jpg" runat="server" /> Here.
it breaks my code. need help!!!!!!
thanks
DIpsa

<telerik:RadEditor ID="RadEditor1" runat="server" Height="600px" ImageManager-EnableImageEditor="false"
AllowScripts="true" OnClientLoad="InsertText"></telerik:RadEditor>
<asp:Button ID="Button1" runat="server" Text="Image Gallery AJAX" OnClick="Button1_Click"/>
< script type="text/javascript">
function InsertText()
{
var intCPos = GetCursorPosition();
if (intCPos != 0)
{
document.getElementById('hfCPOS').value = intCPos;
}
if(document.getElementById('myValue').value != "")
{
var pos = document.getElementById('hfCPOS').value; //gives 14
var editorr = $find("<%=RadEditor1.ClientID%>"); //get a reference to the editor
var strIMG = document.getElementById('myValue').value; // myvalue = <img id='123' src='123.gif' alt=''/>
var strValue = editorr.get_html(true);
strValue = strValue.substring(0,pos)+ strIMG + strValue.substring(pos)
//editorr.pasteHtml(strValue);
editorr.set_html(strValue);
document.getElementById('myValue).value = "";
document.getElementById('hfCPOS').value = "";
}
}
</script>
o/p (after adding 1st image)
Text Will Come<img alt="" id="parts_coupon_01.jpg" src="http://192.168.3.27:88/Files/Images/2/gallery/Coupons//parts_coupon_01.jpg" runat="server" /> Here.
o/p (after adding 2nd image)
now my cursor is between "Text Will Come Here " - 'e' and 'r' of Here
Text Will Come<im<img id="service_coupon_02.jpg" runat="server" src="http://192.168.3.27:88/Files/Images/2/gallery/Coupons//service_coupon_02.jpg" />g alt="" id="parts_coupon_01.jpg" src="http://192.168.3.27:88/Files/Images/2/gallery/Coupons//parts_coupon_01.jpg" runat="server" /> Here.
it breaks my code. need help!!!!!!
thanks
DIpsa

i hav a document in microsoft word document(like a form).i want to fill this document from sql table.....how can i do this??????
plz reply
Telerik.Web.DomElement.addExternalHandler as the javascript library to call (pre the introduction of the $ library), but when I try to call this, I get a popup saying "Exception while executing client event "OnClientLoad" Error: 'Telerik' is undefined." so basically I'm not referencing the library right, but I'm not sure how to do so correctly.
Many thanks for your aid!
FYI, Here's the code for my test application page that throws the exception cited above:
| <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TelerikTest2._Default" %> |
| <%@ Register TagPrefix="telerik" Namespace="Telerik.WebControls" Assembly="RadEditor.Net2" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" > |
| <head runat="server"> |
| <title></title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <script type="text/javascript"> |
| function OnClientLoad(editor, args) |
| { |
| var element = document.all; |
| Telerik.Web.DomElement.addExternalHandler(element, "paste", function(e) { |
| window.setTimeout(function() { |
| //write here your code which you want to execute when the paste event is fired |
| //after that execute the editor's clean filters |
| var oSelElem = editor.get_html(); |
| alert(oSelElem); |
| editor.fire("SelectAll"); |
| editor.fire("FormatStripper", { value: "FONT" }); |
| editor.fire("FormatStripper", { value: "SPAN" }); |
| editor.fire("FormatStripper", { value: "CSS" }); |
| alert(editor.get_html()); |
| alert(oSelElem); |
| }, 300); |
| }); |
| } |
| </script> |
| <telerik:radeditor runat="server" ID="RadEditor1" OnClientLoad="OnClientLoad" StripFormattingOptions="NonesupressCleanMessage"> |
| </telerik:radeditor> |
| </div> |
| </form> |
| </body> |
| </html> |
