<telerik:AjaxSetting AjaxControlID="MatCompAddComponentButton"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="PanelMatComp" UpdatePanelCssClass="" /> </UpdatedControls></telerik:AjaxSetting><asp:Panel ID="PanelMatComp" runat="server" Visible="false"> <telerik:OpenAccessDataSource ID="OpenAccessDataSourceItems" runat="server" ObjectContextProvider="idee5.DispatcherModel.DispatcherEntities, idee5.DispatcherModel" TypeName="idee5.DispatcherModel.Item" Where="this.MasterSystemHierarchy == @MasterSystemHierarchy"> <WhereParameters> <asp:QueryStringParameter Name="MasterSystemHierarchy" QueryStringField="Hierarchy" /> </WhereParameters> </telerik:OpenAccessDataSource> <asp:CheckBox ID="MatCompComplete" runat="server" Enabled="False" Text="Komplettentnahme" /> <telerik:RadComboBox ID="MatCompItemComboBox" Runat="server" Culture="de-DE" DataSourceID="OpenAccessDataSourceItems" DataTextField="Label" DataValueField="Id" EmptyMessage="Bitte Artikel auswählen" EnableAutomaticLoadOnDemand="True" ItemsPerRequest="10" Label="Artikel" LoadingMessage="Lade..." AutoPostBack="True" ShowMoreResultsBox="True" EnableVirtualScrolling="True" Filter="Contains" Height="180px" Width="250px" CausesValidation="False" EnableItemCaching="True"> </telerik:RadComboBox>...</asp:Panel>a.RadComboBoxItemDataBoundEventArgs.registerClass("Telerik.Web.UI.RadComboBoxItemDataBoundEventArgs",a.RadComboBoxItemEventArgs);})();(function(){var a=$telerik.$;var b=Telerik.Web.UI;a.registerEnum(b,"Keys",{Tab:9,Enter:13,Shift:16,Escape:27,Space:32,PageUp:33,PageDown:34,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Insert:45,Del:46,Zero:48,Numpad0:96,Numpad9:105,F1:112,F12:123,Delete:127});a.registerEnum(b,"RadComboBoxFilter",{None:0,Contains:1,StartsWith:2});a.registerEnum(b,"RadComboBoxExpandDirection",{Up:1,Down:2});a.registerEnum(b,"RadComboBoxCheckedItemsTexts",{FitInInput:0,DisplayAllInInput:1});a.registerEnum(b,"RadComboBoxDropDownAutoWidth",{Disabled:0,Enabled:1});})();$telerik.findComboBox=$fiServer Error in '/' Application. FieldEditors collection is empty. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: FieldEditors collection is empty. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [NullReferenceException: FieldEditors collection is empty.] Telerik.Web.UI.RadFilterDataFieldEditorCollection.System.Collections.Generic.IList<Telerik.Web.UI.RadFilterDataFieldEditor>.get_Item(Int32 index) +156 Telerik.Web.UI.RadFilter.AddChildExpression(RadFilterGroupExpressionItem groupItem, Boolean isGroup) +118 Telerik.Web.UI.RadFilterCommandEventArgs.ExecuteCommand(Object source) +173 Telerik.Web.UI.RadFilter.OnBubbleEvent(Object source, EventArgs args) +185 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70 Telerik.Web.UI.RadFilterExpressionItem.OnBubbleEvent(Object source, EventArgs args) +131 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981protected void Page_Load(object sender, EventArgs e){ if (string.IsNullOrEmpty(this.FilterType)) throw new NullReferenceException("FilterType must not be undefined."); var instance = Activator.CreateInstance("MyDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=123456789", "MyDLL.Data.Biz.MetaData." + this.FilterType); PropertyInfo[] properties = instance.GetType().GetProperties( BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public); foreach (PropertyInfo p in properties) { RadFilterDataFieldEditor f = null; if (p.PropertyType == typeof(int)) { f = new RadFilterNumericFieldEditor(); } if (p.PropertyType == typeof(bool)) { f = new RadFilterBooleanFieldEditor(); } if (p.PropertyType == typeof(DateTime)) { f = new RadFilterDateFieldEditor(); } if (p.PropertyType == typeof(string)) { f = new RadFilterTextFieldEditor(); } if (f != null) { filter.FieldEditors.Add(f); } if (!Page.IsPostBack) { if (p.PropertyType == typeof(int)) { f.DisplayName = p.Name.HumanizeString(); f.DataType = typeof(int); f.FieldName = p.Name; f.ToolTip = p.Name; } if (p.PropertyType == typeof(bool)) { f.DisplayName = p.Name.HumanizeString(); f.DataType = typeof(bool); f.FieldName = p.Name; f.ToolTip = p.Name; } if (p.PropertyType == typeof(DateTime)) { f.DisplayName = p.Name.HumanizeString(); f.DataType = typeof(DateTime); f.FieldName = p.Name; f.ToolTip = p.Name; } if (p.PropertyType == typeof(string)) { f.DisplayName = p.Name.HumanizeString(); f.DataType = typeof(string); f.FieldName = p.Name; f.ToolTip = p.Name; } } }}Hi
I have a RadListView bound to an EntityDataSource. Within the ItemTemplate I then have a RadButton with a ContentTemplate.
The RadButton is defined as follows (within the ListView ItemTemplate):
<telerik:RadButton ID="VehicleRadButton" runat="server" ButtonType="StandardButton"
AutoPostBack="true" GroupName="radVehicle" CommandName="Select"
ToggleType="Radio" Text='<%# String.Format("{0}", Eval("f1")) %>'>
<ContentTemplate>
<%# String.Format("[{0}]", Eval("f2")) %>
</ContentTemplate>
</telerik:RadButton>
When I do this an error occurs:
Unable to cast object of type 'Telerik.Web.UI.RadButton' to type 'Telerik.Web.UI.RibbonBarTemplateItem'.
Is it possible to do this?
Thanks
Tony
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="dgv"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="dgv" /> <telerik:AjaxUpdatedControl ControlID="lblStatus" /> <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings></telerik:RadAjaxManager><telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Silk" /><div class="dbStatus"> <asp:Label runat="server" ID="lblStatus" EnableViewState="false" Font-Bold="true" /></div><telerik:RadGrid ID="dgv" runat="server" AutoGenerateColumns="False" PageSize="10" AllowPaging="True" AllowSorting="True" OnNeedDataSource="dgv_NeedDataSource" OnUpdateCommand="dgv_UpdateCommand" OnInsertCommand="dgv_InsertCommand" OnDeleteCommand="dgv_DeleteCommand" OnItemInserted="dgv_ItemInserted"> <MasterTableView TableLayout="Auto" DataKeyNames="Record_Id" ShowHeadersWhenNoRecords="true" EditMode="PopUp"> <NoRecordsTemplate> <div> There are no records </div> </NoRecordsTemplate> <Columns> <telerik:GridBoundColumn UniqueName="colRecordId" DataField="Record_Id" DataType="System.Int64" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,CountryId%>"> <%--<HeaderStyle Width="120" />--%> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colContinent" DataField="Continent" DataType="System.String" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Continent%>"> <%--<HeaderStyle Width="160" />--%> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colContinentBI" DataField="ContinentBI" DataType="System.String" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,ContinentBI%>"> <%--<HeaderStyle Width="160" />--%> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colDescription" DataField="Description" DataType="System.String" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Description%>"> <%--<HeaderStyle Width="200" />--%> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colDescriptionBI" DataField="DescriptionBI" DataType="System.String" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,DescriptionBI%>"> <%--<HeaderStyle Width="200" />--%> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colCreatedBy" DataField="CreatedBy" DataType="System.String" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,CreatedBy%>"> <%--<HeaderStyle Width="120" />--%> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colCreatedON" DataField="CreatedOn" DataType="System.DateTime" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,CreatedDate%>"> <%--<HeaderStyle Width="160" />--%> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colModifiedBy" DataField="ModifiedBy" DataType="System.String" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,ModifiedBy%>"> <%--<HeaderStyle Width="120" />--%> </telerik:GridBoundColumn> <telerik:GridBoundColumn UniqueName="colModifiedOn" DataField="ModifiedOn" DataType="System.DateTime" HeaderText="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,ModifiedDate%>"> <%--<HeaderStyle Width="160" />--%> </telerik:GridBoundColumn> </Columns> <EditFormSettings EditFormType="Template" PopUpSettings-Modal="true"> <FormTemplate> <table> <tr> <td colspan="3"> <br /> <asp:Label runat="server" ID="lblStatus" Font-Bold="true" /> <br /> </td> </tr> <tr> <td class="tdLabel"> <asp:Label runat="server" ID="lblCountryId" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,CountryId%>" AssociatedControlID="txtCountryId" /> </td> <td class="tdControl"> <telerik:RadTextBox ID="txtCountryId" runat="server" Width="300" ReadOnly="true" Text='<%# Bind("Record_Id") %>' /> </td> <td></td> </tr> <tr> <td class="tdLabel"> <asp:Label runat="server" ID="lblContinent" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Continent%>" AssociatedControlID="txtContinent" /> </td> <td class="tdControl"> <telerik:RadTextBox ID="txtContinent" runat="server" Width="300" MaxLength="255" Text='<%# Bind("Continent") %>' /> </td> <td></td> </tr> <tr> <td class="tdLabel"> <asp:Label runat="server" ID="lblContinentBI" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,ContinentBI%>" AssociatedControlID="txtContinentBI" /> </td> <td class="tdControl"> <telerik:RadTextBox ID="txtContinentBI" runat="server" Width="300" MaxLength="255" Text='<%# Bind("ContinentBI") %>' /> </td> <td></td> </tr> <tr> <td class="tdLabel"> <asp:Label runat="server" ID="lblDescription" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Description%>" AssociatedControlID="txtDescription" /> </td> <td class="tdControl"> <telerik:RadTextBox ID="txtDescription" runat="server" Width="300" MaxLength="255" ValidationGroup="CountryValidation" Wrap="false" EmptyMessage="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Description%>" Text='<%# Bind("Description") %>' /> </td> <td> <asp:RequiredFieldValidator ID="rfvDescription" runat="server" ValidationGroup="CountryValidation" ControlToValidate="txtDescription" ErrorMessage="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,DescriptionRequiredValidationMessage%>" Text="*" /> </td> </tr> <tr> <td class="tdLabel"> <asp:Label runat="server" ID="Label1" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,DescriptionBI%>" AssociatedControlID="txtDescriptionBI" /> </td> <td class="tdControl"> <telerik:RadTextBox ID="txtDescriptionBI" runat="server" Width="300" MaxLength="255" ValidationGroup="CountryValidation" Wrap="False" EmptyMessage="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,DescriptionBI%>" Text='<%# Bind("DescriptionBI") %>' /> </td> <td> <asp:RequiredFieldValidator ID="rfvDescriptionBI" runat="server" ValidationGroup="CountryValidation" ControlToValidate="txtDescriptionBI" ErrorMessage="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,DescriptionBIRequiredValidationMessage%>" Text="*" /> </td> </tr> </table> <br /> <br /> <table> <tr> <td class="tdButton"> <telerik:RadButton ID="btnSubmit" runat="server" Width="100%" ValidationGroup="CountryValidation" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Submit%>" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' /> </td> <td class="tdButton"> <telerik:RadButton ID="btnCancel" runat="server" Width="100%" Text="<%$Resources:AM.BLIS.SP.Common.Resources.BLISResource,Cancel%>" CommandName="Delete" /> </td> </tr> </table> </FormTemplate> </EditFormSettings> </MasterTableView></telerik:RadGrid><telerik:RadWindowManager ID="RadWindowManager1" runat="server" />CountryMasterBPO cm = new CountryMasterBPO();protected void dgv_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e){ this.dgv.DataSource = cm.GetAllCountries();}protected void dgv_InsertCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e){ RadAjaxManager1.ResponseScripts.Add(string.Format("Insert Command")); var editableItem = ((GridEditableItem)e.Item); var newCountry = new tbCountry_Master(); Hashtable values = new Hashtable(); e.Item.OwnerTableView.ExtractValuesFromItem(values, editableItem); newCountry.Continent = (string)values["Continent"]; newCountry.ContinentBI = (string)values["ContinentBI"]; newCountry.Description = (string)values["Description"]; newCountry.DescriptionBI = (string)values["DescriptionBI"]; newCountry.Exp1 = "0"; newCountry.Exp2 = "0"; newCountry.CreatedBy = SPContext.Current.Web.CurrentUser.LoginName; newCountry.CreatedOn = DateTime.Now; newCountry.ModifiedBy = SPContext.Current.Web.CurrentUser.LoginName; newCountry.ModifiedOn = DateTime.Now; var result = cm.SaveCountry(newCountry); DisplayMessage(!result, result ? "Sucessfully Saved" : "Error!!! Try Again");}protected void dgv_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e){ RadAjaxManager1.ResponseScripts.Add(string.Format("Update Command")); var editableItem = ((GridEditableItem)e.Item); var recordId = (long)editableItem.GetDataKeyValue("Record_Id"); RadAjaxManager1.ResponseScripts.Add(string.Format("Record Id: {0}", recordId)); var country = cm.GetCountry(recordId); if (country != null) { RadAjaxManager1.ResponseScripts.Add(string.Format("Description: {0}", country.Description)); editableItem.UpdateValues(country); country.ModifiedBy = SPContext.Current.Web.CurrentUser.LoginName; country.ModifiedOn = DateTime.Now; var result = cm.SaveCountry(country); DisplayMessage(!result, result ? "Sucessfully Updated" : "Error!!! Try Again"); }}protected void dgv_DeleteCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e){ RadAjaxManager1.ResponseScripts.Add(string.Format("Delete Command")); var editableItem = ((GridEditableItem)e.Item); var recordId = (long)editableItem.GetDataKeyValue("Record_Id"); bool isReferenced = false; var result = cm.DeleteCountry(recordId, out isReferenced); DisplayMessage(!result, result ? "Sucessfully Deleted" : "Error!!! Try Again");}protected void dgv_ItemInserted(object sender, GridInsertedEventArgs e){ if (e.Exception != null) { e.ExceptionHandled = true; e.KeepInInsertMode = true; DisplayMessage(true, e.Exception.Message.ToString()); }}private void DisplayMessage(bool isError, string text){ this.lblStatus.ForeColor = (isError) ? Color.Red : Color.Green; this.lblStatus.Text = text;}public class Application{ public string AppName { get; set; } public List<Flag> Flags { get; set; }}public class Flag{ public string FlagName { get; set; } public bool IsAssigned { get; set; }}List<Application> apps = new List<Application> { new Application { AppName = "Search App", Flags = new List<Flag> { new Flag { FlagName = "Editor", IsAssigned = true }, new Flag { FlagName = "User", IsAssigned = false }, new Flag { FlagName = "Search", IsAssigned = true }, } }, new Application { AppName = "Probe", Flags = new List<Flag> { new Flag { FlagName = "Master", IsAssigned = false }, new Flag { FlagName = "User", IsAssigned = true }, new Flag { FlagName = "Publisher", IsAssigned = true }, } }, new Application { AppName = "Viewer App", Flags = new List<Flag> { new Flag { FlagName = "Editor", IsAssigned = false }, new Flag { FlagName = "Baker", IsAssigned = true }, new Flag { FlagName = "Search", IsAssigned = false }, } }};<telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager><script type="text/javascript"> kendo.culture("<%= currCulture %>");</script><!--Where currCulture is the variable storing the desired culture--><telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Height="400px" Width="400px"> <PlotArea> <Series> <telerik:PieSeries> <SeriesItems> <telerik:PieSeriesItem Exploded="true" Y="53000" Name="Q1" /> <telerik:PieSeriesItem Exploded="false" Y="35000" Name="Q2" /> <telerik:PieSeriesItem Exploded="false" Y="47500" Name="Q3" /> <telerik:PieSeriesItem Exploded="false" Y="22300" Name="Q4" /> </SeriesItems> <LabelsAppearance DataFormatString="C"> </LabelsAppearance> <TooltipsAppearance DataFormatString="C"></TooltipsAppearance> </telerik:PieSeries> </Series> <YAxis> </YAxis> </PlotArea> <ChartTitle Text="Revenue"> </ChartTitle></telerik:RadHtmlChart>