RadScriptManager? Because in our project we use the script manager from ASP.Net. <telerik:GridTemplateColumn DataField="PortalName" HeaderText="Shop" UniqueName="PortalName" HeaderStyle-Width="200px" SortExpression="PortalName"> <FilterTemplate> <telerik:RadComboBox ID="rcbPortal" DataTextField="PortalName" DataValueField="PortalID" DataSourceID="SqlDataSource1" Height="100px" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("PortalName").CurrentFilterValue %>' runat="server" OnClientSelectedIndexChanged="PortalIndexChanged"> <Items> <telerik:RadComboBoxItem Text="All" /> </Items> </telerik:RadComboBox> <telerik:RadScriptBlock ID="RadScriptBlock3" runat="server"> <script type="text/javascript"> function PortalIndexChanged(sender, args) { var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>"); tableView.filter("PortalName", args.get_item().get_value(), "EqualTo"); } </script> </telerik:RadScriptBlock> </FilterTemplate> <ItemTemplate> <asp:Image ID="imgPortal" runat="server" ImageAlign="AbsBottom" /> <asp:Label ID="lblPortalName" runat="server" Text='<%# Eval("PortalID") %>'></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn>Hi!
I'm trying to reproduce the resource availability demo using ObjectDataSources instead. Trying to build the code from scratch to get to know the component. As soon as I set DataSourceId referencing an ObjectDataSource on either the Scheduler or a ResourceType the scripts from WebResource is not included in the page. Before I add the datasource, two scripts are loaded and it checks whether Sys is undefined, but when the datasource is set, the scripts are not there and it just attempts to start the initialization.
I use the Q1 2011 version.
Any ideas?
Here's the code:
(If you remove DataSourceID, GroupBy and ResourceTypes, it works fine, otherwise scripts is not loaded)
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Scheduler.aspx.cs" Inherits="TelerikPrototyping.Scheduler" %><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><!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></head><body> <form id="form1" runat="server"> <telerik:RadScriptManager runat="server" ID="RadScriptManager" > </telerik:RadScriptManager> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadScheduler1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadScheduler" LoadingPanelID="RadAjaxLoadingPanel" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel" /> <asp:ObjectDataSource runat="server" ID="EntriesDataSource" TypeName="TelerikPrototyping.Scheduler" SelectMethod="GetEntries" OnObjectCreating="OnDataSourceCreating" DataObjectTypeName="TelerikPrototyping.SchedulerEntry, Telerik.Calendar" /> <asp:ObjectDataSource runat="server" ID="RoomsDataSource" TypeName="TelerikPrototyping.Scheduler" SelectMethod="GetRooms" OnObjectCreating="OnDataSourceCreating" DataObjectTypeName="TelerikPrototyping.Room, Telerik.Calendar" /> <div> <telerik:RadScheduler runat="server" ID="RadScheduler" DataKeyField="Id" DataSubjectField="Subject" DataStartField="Start" DataEndField="End" HoursPanelTimeFormat="HH:mm" GroupBy="Rooms" DataSourceID="EntriesDataSource" > <ResourceTypes> <telerik:ResourceType DataSourceID="RoomsDataSource" KeyField="Id" ForeignKeyField="RoomId" TextField="Name" Name="Rooms" /> </ResourceTypes> </telerik:RadScheduler> </div> </form></body></html>
using System;using System.Collections.Generic;using System.Web.UI.WebControls;namespace TelerikPrototyping{ public partial class Scheduler : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void OnDataSourceCreating(object sender, ObjectDataSourceEventArgs e) { e.ObjectInstance = this; } public List<SchedulerEntry> GetEntries() { return GetSessionList("entries", new SchedulerEntry("test", DateTime.Today.AddHours(13), DateTime.Today.AddHours(14), GetRooms()[0].Id, new Guid[0])); } public List<Room> GetRooms() { return GetSessionList("rooms", new Room("Rom 1"), new Room("Rom 2"), new Room("Rom3")); } public List<Person> GetPersons() { return GetSessionList("persons", new Person("Ola"), new Person("Kari"), new Person("Per")); } private List<T> GetSessionList<T>(string key, params T[] initial) where T : class { if (Session[key] == null) Session[key] = new List<T>(initial); return (List<T>) Session[key]; } } public class SchedulerEntry { public Guid Id { get; private set; } public string Subject { get; private set; } public DateTime Start { get; private set; } public DateTime End { get; private set; } public Guid RoomId { get; private set; } public Guid[] PersonIds { get; private set; } public SchedulerEntry() { } public SchedulerEntry(Guid id, string subject, DateTime start, DateTime end, Guid roomId, Guid[] personIds) { Id = id; Subject = subject; Start = start; End = end; RoomId = roomId; PersonIds = personIds; } public SchedulerEntry(string subject, DateTime start, DateTime end, Guid roomId, Guid[] personIds) { Id = Guid.NewGuid(); Subject = subject; Start = start; End = end;
RoomId = roomId; PersonIds = personIds; } } public class Room { public Guid Id { get; private set; } public string Name { get; private set; } public Room(Guid id, string name) { Id = id; Name = name; } public Room(string name) { Id = Guid.NewGuid(); Name = name; } public Room() { } } public class Person { public Guid Id { get; private set; } public string Name { get; private set; } public Person(Guid id, string name) { Id = id; Name = name; } public Person(string name) { Id = Guid.NewGuid(); Name = name; } }}
Never mind the Session state of the data sources - that will change when everything works. ;)
Lars-Erik
if (!Page.IsPostBack){ object folderOb = Request.QueryString["Folder"]; if (folderOb == null) return; int folderId = int.Parse(folderOb.ToString()); while (grdFolders.CurrentPageIndex < grdFolders.PageCount) { foreach (GridDataItem dataItem in grdFolders.Items) { Folder folder = dataItem.DataItem as Folder; if (folder.FolderId == folderId) { dataItem.Selected = true; grdFolderIndex.Rebind(); return; } } ++grdFolders.CurrentPageIndex; grdFolders.Rebind(); }}
<telerik:RadComboBox EnableTextSelection="false" ID="RadComboBoxForm" Skin="Office2007" CollapseAnimation-Type="InCubic" ExpandAnimation-Type="OutCubic" runat="server" SelectedValue='<%# Eval( "FormTypeId" ) %>' Text='<%# Bind( "FormTypeId" ) %>'>
<Items>
<telerik:RadComboBoxItem runat="server" Text="" Value="" />
<telerik:RadComboBoxItem runat="server" Text="Caplet" Value="1" />
<telerik:RadComboBoxItem runat="server" Text="Capsule" Value="2" />
<telerik:RadComboBoxItem runat="server" Text="Controlled Release" Value="3" />
<telerik:RadComboBoxItem runat="server" Text="Elixir" Value="4" />
<telerik:RadComboBoxItem runat="server" Text="Ointment" Value="5" />
<telerik:RadComboBoxItem runat="server" Text="Solution" Value="6" />
<telerik:RadComboBoxItem runat="server" Text="Supplement" Value="7" />
<telerik:RadComboBoxItem runat="server" Text="Suspension" Value="8" />
<telerik:RadComboBoxItem runat="server" Text="Syrup" Value="9" />
<telerik:RadComboBoxItem runat="server" Text="Tablet" Value="10" />
</Items>
</telerik:RadComboBox>
I am databinding, and I have an integer key awaiting the value of the radcombo in the database. I am finding that it is finding the text value and not the "Value" of the radcombobox which is an integer. Is there any way to store the integer value in the database instead ?
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomCertificateEdit.aspx.cs" Inherits="Web.Admin.CustomCertificateEdit" MasterPageFile="~/Core/DefaultMasterPage.master" %> <%@ MasterType VirtualPath="~/Core/DefaultMasterPage.master" %> <%@ Import Namespace="Telerik.Web.UI" %> <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="headPlaceHolder"> <style type="text/css"> .radeditorContainer { margin-left: auto; margin-right: auto; width: 610px; } .customCertContentContainer { margin-left: auto; margin-right: auto; width: 850px; } .radEditorErrorColumn { vertical-align: bottom; } .reTool .ImportField { background-image: url(<%= ResolveUrl("~/images/icon_popup_search.gif") %>); } </style> <script type="text/javascript" language="javascript"> function radEditor_ClientCommand(editor, args) { if (args.get_commandName() == "ImageManager") { var callback = function (sender, args) { var result = args.get_value(); $get("hdnImagesUploaded").value += (result.src + ","); editor.pasteHtml(result, "ImageManager"); }; args.set_callbackFunction(callback); } } </script> </asp:Content> <asp:Content ID="Content2" runat="server" ContentPlaceHolderID="ContentPlaceHolder1"> <asp:HiddenField ID="hdnImagesUploaded" runat="server" /> <cs:CsPanel runat="server" ID="pnlCertificates" Title="Custom Certificate Advanced Editor" DoLocalize="true"> <br /> <br /> <div class="customCertContentContainer"> <div class="radeditorContainer"> <span class="FieldName"> <%= "Certificate Title:".Localize() %></span> <asp:TextBox ID="txtTitle" runat="server" MaxLength="300" CssClass="FieldValue" Style="width: 300px;" /> <asp:RequiredFieldValidator ID="reqvTitle" ControlToValidate="txtTitle" runat="server" Text="*" /><br /> <br /> <div style="float: left;"> <cs:CsodRadEditor ID="radeditorCntrl" runat="server" EditorStyle="Advanced" Width="595" EnableHtmlEdit="true" EnableResize="false" AllowScripts="false" Skin="Windows7" ExternalDialogsPath="~/Core/Telerik" /> </div> <div class="radEditorErrorColumn"> <asp:RequiredFieldValidator ID="reqvRadEditor" ControlToValidate="radeditorCntrl" runat="server" Text="*" /> </div> <div style="clear: both;"> </div> <br /> <br /> <cs:CsImageButton ID="btnSave" runat="server" TemplateName="done" OnClick="btnSave_Click" /> <cs:CsImageButton ID="btnCancel" runat="server" TemplateName="cancel" OnClick="btnCancel_Click" /> </div> </div> </cs:CsPanel> <script language="javascript"> Telerik.Web.UI.Editor.CommandList["ImportField"] = function (commandName, editor, args) { //window.popupCaller = 'textbox'; alert('import field'); }; </script> </asp:Content>protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.Title = "Advanced Certificate Page Editor".Localize(); this.breadCrumbs.Reload(""); if (!isNew) { CertificateEntityModel model = this.PullCertificateFromId(certificateId.Value); if (model != null) { txtTitle.Text = model.Title; radeditorCntrl.Content = model.Html; } } //add the custom import field button EditorTool importFieldTool = new EditorTool("Import Field", string.Empty); importFieldTool.Name = "ImportField"; importFieldTool.Text = "Import Field".Localize(); radeditorCntrl.Tools[1].Tools.Add(importFieldTool); //setup the image manager's filepaths and maxfile size string[] webPath = new string[] { Functions.GetPublicClientCustomCertificatesUploadPath(CorpName) }; radeditorCntrl.ImageManager.ViewPaths = webPath; radeditorCntrl.ImageManager.UploadPaths = webPath; radeditorCntrl.ImageManager.DeletePaths = webPath; radeditorCntrl.ImageManager.MaxUploadFileSize = ONE_MEG; radeditorCntrl.OnClientCommandExecuted = "radEditor_ClientCommand"; } }