
<%@ Page Title="" Language="C#" MasterPageFile="~/APPmaster.master" AutoEventWireup="true" CodeFile="FacultyAdvisorBulkUpload.aspx.cs" Inherits="Common.Common_FacultyAdvisorBulkUpload" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <script type="text/javascript"> function DownloadTemplate() { var url = '../Common/Templates/FacultyAdvisors.csv'; //location.href = url; window.open(url, 'Download'); } </script> <script type="text/javascript"> // This function helps to make the page tab fit the height of RadGrid function GridCreated(sender, args) { //alert(document.getElementById(sender.get_id()).clientHeight); var gridObj = document.getElementById(sender.get_id()); var tabObj = document.getElementById('<%=RadMultiPage.ClientID %>'); var searchObj = document.getElementById('search-area'); tabObj.style.height = (gridObj.clientHeight + searchObj.clientHeight) + 'px'; } // When clicking export, disable the AJAX function onRequestStart(sender, args) { if (args.get_eventTarget().indexOf("ExportTo") >= 0) { args.set_enableAjax(false); } } </script> <br /><br /> <telerik:RadTabStrip runat="server" ID="RadTabStrip" Skin="Outlook" SelectedIndex="0" MultiPageID="RadMultiPage"> <Tabs> <telerik:RadTab Text="Advisor List" ToolTip="View Faculty Advisor Relationship" /> <telerik:RadTab Text="Advisor Bulk Update" ToolTip="Tool to Import Grades to APP." runat="server" /> </Tabs> </telerik:RadTabStrip> <telerik:RadMultiPage runat="server" ID="RadMultiPage" SelectedIndex="0" CssClass="pageView"> <telerik:RadPageView runat="server" ID="RadPageView" > <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Hay"> </telerik:RadAjaxLoadingPanel> <div id="search-area" style="padding:10px 0 20px 0;"> <b>Faculty Name:</b> <telerik:RadTextBox ID="FacultyNameCond" runat="server" /> <b>Student Name:</b> <telerik:RadTextBox ID="StudentNameCond" runat="server" /> <b>Class:</b> <telerik:RadComboBox ID="ClassCond" runat="server" ViewStateMode="Enabled" /> <telerik:RadButton ID="SearchButton" runat="server" Text="Search" OnClick="SearchButton_Click" /> <telerik:RadButton ID="ExportButton" runat="server" Text="Export to XLS" OnClick="ExportButton_Click" /> </div> <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" ClientEvents-OnRequestStart="onRequestStart"> <telerik:RadGrid runat="server" ID="RadGridAdvisorList" Skin="Hay" Width="900px" GridLines="None" OnItemDataBound="RadGridAdvisorList_ItemDataBound" AutoGenerateColumns="False" AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="false" HeaderStyle-Font-Bold="true" HeaderStyle-Font-Size="Small"> <PagerStyle Mode="NextPrevAndNumeric" /> <MasterTableView DataKeyNames="ID" ClientDataKeyNames="ID" PageSize="10" AllowMultiColumnSorting="true"> <GroupByExpressions> <telerik:GridGroupByExpression> <GroupByFields> <telerik:GridGroupByField FieldName="FacultyName" /> </GroupByFields> <SelectFields> <telerik:GridGroupByField FieldName="FacultyName" /> </SelectFields> </telerik:GridGroupByExpression> </GroupByExpressions> <CommandItemSettings ShowAddNewRecordButton="false" /> <Columns> <telerik:GridBoundColumn DataField="FacultyName" HeaderText="Faculty Name" Display="false" /> <telerik:GridBoundColumn DataField="FacultyID" HeaderText="Faculty Email" Display="false" /> <telerik:GridImageColumn DataType="System.String" DataImageUrlFields="ImageLink" DataImageUrlFormatString="~/Pics/{0}" AlternateText="Student image" DataAlternateTextField="StudentName" ImageAlign="Middle" ImageWidth="57px" ImageHeight="72px" AllowFiltering="false" HeaderStyle-Width="64px" /> <telerik:GridBoundColumn DataField="StudentName" HeaderText="Student Name" AllowFiltering="false" HeaderStyle-Width="160px" /> <telerik:GridBoundColumn DataField="StudentID" HeaderText="Student ID" AllowFiltering="false" HeaderStyle-Width="90px" /> <telerik:GridBoundColumn DataField="Email" HeaderText="Email" AllowFiltering="false" HeaderStyle-Width="160px" /> <telerik:GridBoundColumn DataField="Status" HeaderText="Status" AllowFiltering="false" HeaderStyle-Width="160px" /> <telerik:GridBoundColumn DataField="Class" HeaderText="Class" AllowFiltering="false" HeaderStyle-Width="90px" /> <%-- <telerik:GridTemplateColumn> <ItemTemplate> <input type="image" src="../Styles/Images/Snapshot.gif" alt="Select" /> </ItemTemplate> </telerik:GridTemplateColumn> --%> </Columns> </MasterTableView> <ClientSettings> <Selecting AllowRowSelect="true" /> <ClientEvents OnGridCreated="GridCreated" /> </ClientSettings> </telerik:RadGrid> </telerik:RadAjaxPanel> </telerik:RadPageView> <telerik:RadPageView runat="server" ID="BulkUploadView"> <div class="pageTitle"><b>Advisor Bulk Update</b></div> <div id="ContainerDiv" class="legendBorderStaff" style="Height: 200px;"> <div class="tabWrapper"> <div class="regularLabel"> 1. Download Template (if necessary): <br /> <button id="btnTemplate" onclick="javascript:DownloadTemplate();" title="Download Template" >Download</button> <%--<asp:Button ID="Button1" runat="server" Text="Download" ToolTip="Download the proper template." onclick="BtnTemplate_Click" /> --%> <br /><br /> 2. Select the file: <telerik:RadUpload ID="RadUpload" runat="server" Skin="Outlook" AllowedFileExtensions="csv" /> <asp:CustomValidator ID="CustomValidator1" runat="server" CssClass="errorLabel" ErrorMessage="Please select at least one CSV file." OnServerValidate="CustomValidator1_ServerValidate"> </asp:CustomValidator> <br /> 3. Submit your file: <br /> <asp:Button ID="BtnSumbit" runat="server" Text="Import" ToolTip="Import advisors into APP system." onclick="BtnSumbit_Click" Width="150px" /> </div> </div> </div> <br /> <div class="errorLabel"> <asp:Image ID="SuccessImg" runat="server" ImageUrl="../Images/success.gif" Visible="false" /> <asp:Image ID="ErrorImg" runat="server" ImageUrl="../Images/error.gif" Visible="false" /> <asp:Label ID="OutputLabel" ForeColor="Red" runat="server" Visible="false" /> </div> <div class="details" > <asp:Label ID="lblReport" runat="server" /> </div> </telerik:RadPageView> </telerik:RadMultiPage></asp:Content><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