This is a migrated thread and some comments may be shown as answers.

[Solved] Insert Image in RadEditor Dynamically

1 Answer 233 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Dipsa Shah
Top achievements
Rank 1
Dipsa Shah asked on 08 Jul 2009, 02:19 PM
Hi,

I am working in Rad Editor and trying to implement different functionality which make my application user friendly.
Let me explain what I need to know from you.

I have one Editor.aspx page and it has RadEditore and Linkbutton call ImageGallery. When I click on ImageGallery, it opens one popup windows with Images. Once I select Image (by clicking on Select link on PopUP), I am passing that Image path to my Editor.aspx page through session.I made Dynamic Image control also. 

----------------------Editor.aspx.cs ---------------------------------------------
 string strPAth = Convert.ToString(Session["strPath"]);
 Image img = new Image();
 img.ImageUrl = strPAth ; 
                                                         // Is there any way I can add image here like RadEditor1. (insert or something) ???
StringBuilder sb = new StringBuilder();
sb.Append("OnClientLoad('" + strPAth  + "')");
ClientScript.RegisterClientScriptBlock(this.GetType(), "OnClientLoadScript",
 sb.ToString(), true); 

----------------------Javs Script on Editor.aspx---------------------------------------------
<script type="text/javascript">    
function OnClientLoad(imgPath)   
{   
        var nod=document.createElement("img");
        nod.src = imgPath;
        document.getElementById("RadEditor1ContentHiddenTextarea").appendChild(nod);  // Its not working...Getttin Error. document.getElementById() null or not found.
}   
</script>

Now Which function I shoud write so I will get that image in my RadEditor ? Eevery time Editor.aspx page get refreshed when I select Image from popUp WIndow. And it should allow me to add multiple Images from POpUp.

Looking for your help. Its urgent.

Thanks
Dipsa

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 13 Jul 2009, 06:48 AM
Hi Dipsa,

You can use the emoticons custom dialog example as a base to implement your scenario: Custom Dialogs. The code used in the example is available in the RadControls for ASP.NET AJAX demo installation.

You can paste content in the editor using the pasteHtml client-side method:

editor.pasteHtml(String.format("<img src='{0}' border='0' align='middle' alt='emoticon' /> ", args.image));

Best regards,
Rumen
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.
Tags
Editor
Asked by
Dipsa Shah
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or