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

Is it possible to achive?

3 Answers 75 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Vincent
Top achievements
Rank 1
Vincent asked on 18 Jun 2010, 06:27 AM
Hi Telerik team

My scenario is I had a custom button in the editor toolbar which will popup my custom radwindow, I want to pass the current editor value to the popup and do a regular expression search during page load event inside popup. I am trying to assign the whole editor content into a hidden field in a javascript on popup window first, then retrieve the content from radwindow page load event, unfortunately I can't get this value from the hidden field in page load event from radwindow, but I can get the value if there is a postback event fired on the radwindow.

Here is my javascript on my popup radwindow

<script type="text/javascript"
 
    Sys.Application.add_load(loadData); 
 
    function loadData() { 
        var currentWindow = GetRadWindow().BrowserWindow; 
        hidInput = $('#<%=hidContent.ClientID %>'); 
        alert(hidInput.val()); 
        alert(currentWindow.sm5_editor._editor.get_html(false)); 
        //alert(currentWindow.sm5_editor._editor.get_html(false)); 
        hidInput.val(currentWindow.sm5_editor._editor.get_html(false)); 
    } 
</script> 
    <div style="padding-top:20px">Please select a bookmark</div> 
    <div style="padding-top:5px;"
        <telerik:RadComboBox ID="rcbInsertBookmarkLink" runat="server" Width="340"></telerik:RadComboBox> 
    </div> 
    <div style="position:absolute; top:40px; left:362px;"
        <img runat="server" id="imgRedAlert" visible="false" src="~/App_Themes/Modern/images/Icons/16x16/redalert.gif" /> 
    </div> 
<input type="hidden" id="hidContent" value="sadfsadf " runat="server" /> 
</asp:Content> 


Here is my code behind
        protected void Page_Load(object sender, EventArgs e) 
        { 
            Master.cmdOk.Click += cmdOk_Click; 
            if (!IsPostBack) 
            { 
                BindBookmarks(); 
            } 
        } 
 
        protected void BindBookmarks() 
        { 
            //EmailsInfo email = EmailsManager.GetEmail(SmartmailQuerystring.EmailId); 
            string emailContent = HttpUtility.UrlDecode(hidContent.Value); 
 
            var reg = new Regex(EditorText.BookmarkRegex, GetRegOptions()); 
            var bs = (from Match item in reg.Matches(emailContent) 
                      select new BookmarkInfo 
                                 { 
                                     BookmarkName = item.Result("$1"), BookmarkType = BookmarkType.EmailBookmark, BookmarkId = Guid.NewGuid().ToString().Replace("-"""
                                 }).ToList(); 
 
            rcbInsertBookmarkLink.DataTextField = "BookmarkName"
            rcbInsertBookmarkLink.DataValueField = "BookmarkId"
            rcbInsertBookmarkLink.DataSource = bs; 
            rcbInsertBookmarkLink.DataBind(); 
        } 


3 Answers, 1 is accepted

Sort by
0
Vincent
Top achievements
Rank 1
answered on 18 Jun 2010, 01:14 PM
To simplify my question, I want to pass the whole editor content to the popup window and during popup window load I can retrieve data from code behind at Page_Load event.
0
Dobromir
Telerik team
answered on 23 Jun 2010, 10:45 AM
Hi Vincent,

The content of RadEditor is not accessible because the hidden filed is not populated in the server-side Page_Load event. This is because the server-side events are executed before the client-side events.

For your scenario I suggest you to pass the content of the editor through the session variable.

Sincerely yours,
Dobromir
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Vincent
Top achievements
Rank 1
answered on 23 Jun 2010, 01:01 PM
Hi Telerik Team

Thanks for your answer. After struggling a day, I finally choose this way to pass the editor data. I couldn't find any better way to do that, but I still concern the size and memoy usage issue.
Tags
Editor
Asked by
Vincent
Top achievements
Rank 1
Answers by
Vincent
Top achievements
Rank 1
Dobromir
Telerik team
Share this question
or