Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Cute Editor for .NET
»
Re: PasteHTML
Re: PasteHTML
05-29-2009, 1:00 AM
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: PasteHTML
Reply
Quote
Hi,
Try this example
<%@ Page Language=
"VB"
%>
<%@ Register
Assembly
=
"AjaxControlToolkit"
Namespace
=
"AjaxControlToolkit"
TagPrefix=
"ajaxtoolkit"
%>
<%@ Register
Assembly
=
"CuteEditor"
Namespace
=
"CuteEditor"
TagPrefix=
"CE"
%>
<!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 id=
"Head1"
runat=
"server"
>
<title>test</title>
</head>
<script type=
"text/javascript"
>
function insertLink()
{
var editor1 = document.getElementById(
'<%= Editor1.ClientID%>');
var tex1=document.getElementById(
"<%= textBox1.ClientID %>"
).value;
var tex2=document.getElementById(
"<%= textBox2.ClientID %>"
).value;
var HyperLinkMarkUp =
'<a href=\"' + tex1 + '\" target="_blank" >' + tex2 + '</a>';
editor1.PasteHTML(HyperLinkMarkUp);
editor1.FocusDocument();
}
</script>
<body>
<form id=
"form1"
runat=
"server"
>
<asp:ScriptManager ID=
"ScriptManager1"
runat=
"server"
>
</asp:ScriptManager>
<asp:UpdatePanel ID=
"UpdatePanel1"
runat=
"server"
>
<ContentTemplate>
<CE:Editor ID=
"Editor1"
runat=
"server"
>
</CE:Editor>
<asp:Button ID=
"button1"
runat=
"server"
Text=
"InsertLink"
/>
<asp:Panel ID=
"panel1"
runat=
"server"
BackColor=
"Red"
Width=
"300px"
Height=
"100px"
Style=
"padding-left: 80px; padding-top: 40px"
>
<asp:TextBox ID=
"textBox1"
runat=
"server"
></asp:TextBox>
<asp:TextBox ID=
"textBox2"
runat=
"server"
></asp:TextBox><br />
<input type=
"button"
id=
"btn_insert"
onclick=
"insertLink()"
value=
"Insert"
/>
</asp:Panel>
<ajaxtoolkit:ModalPopupExtender ID=
"ModalPopupExtender1"
runat=
"server"
TargetControlID=
"button1"
OkControlID=
"btn_insert"
PopupControlID=
"panel1"
>
</ajaxtoolkit:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
Regards,
Ken
View Complete Thread