I'm trying to extend the "XmlHttpPanel / Initiating content load client-side" example. I would like to have a few form fields and a RadEditor inside the XmlHttpPanel. Essential I would like very similar functionality to the "Use as container" RadWindow example with the additioon of a RadEditor and no window.
Unfortunately when placing the RadEditor inside the XmlHttpPanel the editor does not behave as expected. In IE the RadEditor toolbars disappear and the content is never updated. In FireFox the content is update.
Am I doing something wrong or is this just not possible? Or is there a better alternative solution?
ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ContentEditor.aspx.cs" Inherits="ContentEditor" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title></title> |
<telerik:radscriptblock id="RadScriptBlock" runat="server"> |
<script type="text/javascript"> |
function rowSelected(sender, args) { |
var key = args.getDataKeyValue("ContentId"); |
var panel = $find("<%=RadXmlHttpPanel.ClientID%>"); |
panel.set_value(key); |
} |
</script> |
</telerik:radscriptblock> |
</head> |
<body> |
<form id="form1" runat="server"> |
<div> |
<asp:scriptmanager id="ScriptManager" runat="server" /> |
<div style="margin-bottom: 10px;"> |
<label style="font-family:'segoe ui', arial, sans-serif;font-size:13px;">Group:</label> |
<telerik:radcombobox id="ContentGroupRadComboBox" runat="server" datasourceid="ContentGroupDataSource" datatextfield="ContentGroupName" datavaluefield="ContentGroupId" appenddatabounditems="true" autopostback="true" width="210" > |
<items> |
<telerik:radcomboboxitem text="All" value="0" selected="true" /> |
</items> |
</telerik:radcombobox> |
</div> |
<telerik:radgrid id="ContentRadGrid" runat="server" datasourceid="ContentDataSource" allowpaging="true" autogeneratecolumns="false" width="250px" style="overflow:hidden"> |
<mastertableview clientdatakeynames="ContentId"> |
<columns> |
<telerik:gridboundcolumn uniquename="ContentName" datafield="ContentName" headertext="Name" itemstyle-wrap="false" /> |
</columns> |
</mastertableview> |
<clientsettings enablerowhoverstyle="true" selecting-allowrowselect="true"> |
<clientevents onrowselected="rowSelected" ondatabound="" /> |
</clientsettings> |
<pagerstyle mode="NumericPages" showpagertext="false" /> |
</telerik:radgrid> |
<telerik:radajaxmanager id="RadAjaxManager" runat="server" enableajax="true" defaultloadingpanelid="RadAjaxLoadingPanel"> |
<ajaxsettings> |
<telerik:ajaxsetting ajaxcontrolid="ContentGroupRadComboBox"> |
<updatedcontrols> |
<telerik:ajaxupdatedcontrol controlid="ContentRadGrid" loadingpanelid="RadAjaxLoadingPanel" /> |
<telerik:ajaxupdatedcontrol controlid="ContentGroupRadComoboBox" /> |
</updatedcontrols> |
</telerik:ajaxsetting> |
</ajaxsettings> |
</telerik:radajaxmanager> |
<div style="margin-top: 25px;border: dashed 2px red;"> |
<telerik:radxmlhttppanel id="RadXmlHttpPanel" runat="server" onservicerequest="RadXmlHttpPanel_ServiceRequest"> |
<asp:label id="selectContentLabel" runat="server" text="Select a content item." /> |
<asp:label id="selectedContentIdLabel" runat="server" /> |
<telerik:radeditor id="RadEditor" runat="server" /> |
</telerik:radxmlhttppanel> |
</div> |
<telerik:radajaxloadingpanel id="RadAjaxLoadingPanel" runat="server" /> |
<asp:sqldatasource id="ContentGroupDataSource" runat="server" connectionstring="<%$ ConnectionStrings:InternationalConnectionString %>" selectcommand="SELECT [ContentGroupId], [ContentGroupName] FROM [IS].[ContentGroupInfo] WITH (NOLOCK) WHERE [StoreId] = '49D4B1F4-236B-DE11-870E-001A6465230E' AND [CultureId] = 1033" /> |
<asp:sqldatasource id="ContentDataSource" runat="server" connectionstring="<%$ ConnectionStrings:InternationalConnectionString %>" /> |
</div> |
</form> |
</body> |
</html> |
Codebehind
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Web; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
using Telerik.Web.UI; |
public partial class ContentEditor : System.Web.UI.Page |
{ |
protected void Page_Init(Object sender, EventArgs e) |
{ |
} |
protected void Page_Load(object sender, EventArgs e) |
{ |
if (ContentGroupRadComboBox.SelectedValue == "0") |
{ |
ContentDataSource.SelectCommand = "SELECT [CI].[ContentGroupId], [CI].[ContentGroupName], [CI].[ContentId], [CI].[ContentName] FROM [IS].[ContentInfo] AS [CI] WITH (NOLOCK) WHERE [CI].[StoreId] = '49D4B1F4-236B-DE11-870E-001A6465230E' AND [CI].[CultureId] = 1033"; |
ContentRadGrid.DataBind(); |
} |
else |
{ |
ContentDataSource.SelectCommand = "SELECT [CI].[ContentGroupId], [CI].[ContentGroupName], [CI].[ContentId], [CI].[ContentName] FROM [IS].[ContentInfo] AS [CI] WITH (NOLOCK) WHERE [CI].[StoreId] = '49D4B1F4-236B-DE11-870E-001A6465230E' AND [CI].[ContentGroupId] = '" + ContentGroupRadComboBox.SelectedValue + "' AND [CI].[CultureId] = 1033"; |
ContentRadGrid.DataBind(); |
} |
} |
protected void RadXmlHttpPanel_ServiceRequest(Object sender, RadXmlHttpPanelEventArgs e) |
{ |
String selectedContentId = e.Value; |
selectedContentIdLabel.Text = selectedContentId; |
selectContentLabel.Visible = false; |
RadEditor.Content = selectedContentId; |
} |
} |