Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Cute Editor for .NET
»
Re: Possible to use Image Gallery and Image Upload without Cute Editor?
Re: Possible to use Image Gallery and Image Upload without Cute Editor?
06-17-2009, 2:48 AM
Kenneth
Joined on 02-13-2008
Posts 3,886
Re: Possible to use Image Gallery and Image Upload without Cute Editor?
Reply
Quote
Hi debierman,
Try this example
<%@ Register TagPrefix=
"CE"
Namespace=
"CuteEditor"
Assembly=
"CuteEditor"
%>
<%@ Page Language=
"C#"
%>
<html>
<head>
<title>ASP and ASP.NET WYSIWYG Editor - Use CuteEditor
as
an image selector</title>
</head>
<body>
<form runat=
"server"
>
<table border=
"0"
cellpadding=
"0"
cellspacing=
"0"
>
<tr>
<td width=
"10"
nowrap>
</td>
<td width=
"20"
nowrap>
</td>
<td valign=
"top"
width=
"760"
>
<b>Use CuteEditor
as
an image selector</b>
<hr>
This example demonstrates how to use CuteEditor
as
an image selector.
<br>
<br>
<asp:TextBox ID=
"imageFld"
Width=
"300"
runat=
"server"
/>
<input type=
"button"
value=
"Change Image"
onclick=
"callInsertImage()"
id=
"Change"
runat=
"server"
name=
"Change"
>
<div>
<CE:Editor ID=
"Editor1"
runat=
"server"
Width=
"1"
Height=
"1"
AutoConfigure=
"None"
ShowHtmlMode=
"False"
ShowPreviewMode=
"False"
EnableContextMenu=
"false"
ShowGroupMenuImage=
"False"
ShowBottomBar=
"False"
BackColor=
"White"
BorderColor=
"White"
>
</CE:Editor>
<br>
</div>
</td>
<tr>
</tr>
</table>
</form>
<script language=
"javascript"
>
function callInsertImage()
{
var editor1 = document.getElementById(
'<%=Editor1.ClientID%>'
);
editor1.FocusDocument();
var editdoc = editor1.GetDocument();
editor1.ExecCommand(
'new'
);
editor1.ExecCommand(
'InsertImage'
);
InputURL();
}
function InputURL()
{
var editor1 = document.getElementById(
'<%=Editor1.ClientID%>'
);
var editdoc = editor1.GetDocument();
var imgs = editdoc.images;
if
(imgs.length>0)
{ document.getElementById(
"imageFld"
).value = imgs[imgs.length-1].src;
editor1.ExecCommand(
'new'
);
document.getElementById(
"imageFld"
).focus();
}
else
{
setTimeout(InputURL,500);
}
}
</script>
</body>
</html>
Regards,
Ken
View Complete Thread