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
Here is my code behind
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(); |
| } |