All Products
Demos
Pricing
Services
Blogs
Docs & Support
Search
Shopping cart
Login
Contact Us
Get A Free Trial
close mobile menu
Telerik Forums
/
UI for ASP.NET AJAX Forum
/
Editor
/
Insert img tag from ImageManager with border = 0
Cancel
Telerik UI for ASP.NET AJAX
Resources
Buy
Try
Feed for this thread
3 posts, 0 answers
วรวุฒิ
21 posts
Member since:
Oct 2007
Posted 05 Sep 2009
Link to this post
It possible to be add img tag with border="0" properties by default after add new picture in Radeditor?
Because when used we make this picture to picturelink the browser it showing link border around picture.
Thanks Telerik Team.
Worawut Boontan
Product Manager
TBD
http://www.theiconweb.com
Rumen
Admin
14422 posts
Posted 08 Sep 2009
Link to this post
Hello Worawut,
Using the following code you will add border = "0" to all images inserted in the content area through the image manager:
<script type=
"text/javascript"
>
function
OnClientPasteHtml(editor, args) {
var
commandName = args.get_commandName();
var
value = args.get_value();
if
(commandName ==
"ImageManager"
)
{
//See if an img has an alt tag set
var
div =
document
.createElement(
"DIV"
);
//Do not use div.innerHTML as in IE this would cause the image's src or the link's href to be converted to absolute path.
//This is a severe IE quirk.
Telerik.Web.UI.Editor.Utils.setElementInnerHtml(div,value);
//Now check if there is alt attribute
var
img = div.firstChild;
img.setAttribute(
"border"
,
"0"
);
//Set new content to be pasted into the editor
args.set_value(div.
innerHTML
);
}
}
</script>
<telerik:RadEditor ID=
"RadEditor1"
runat=
"server"
OnClientPasteHtml=
"OnClientPasteHtml"
>
<ImageManager ViewPaths=
"~/images"
UploadPaths=
"~/images"
DeletePaths=
"~/images"
/>
<Content>
</Content>
</telerik:RadEditor>
The solution is based on the following live example:
OnClientPasteHtml
.
Sincerely,
Rumen
the Telerik team
Instantly find answers to your questions on the new
Telerik Support Portal
.
Watch a
video
on how to optimize your support resource searches and
check out more tips
on the blogs.
วรวุฒิ
21 posts
Member since:
Oct 2007
Posted 08 Sep 2009
Link to this post
It work fine. Thanks.
Cheer
Worawut Boontan
Back to Top
Close