Setting, RadScheduler ResourceHeaderTemplate in code

2 posts, 0 answers
  1. Arvind
    Arvind avatar
    12 posts
    Member since:
    Jun 2012

    Posted 13 Jun 2012 Link to this post


    I need to create a rasScheduler dynamically from code, I need to change the header template is it possible to replicate the below snippet in code and assign it to the scheduler dynamically.

        <asp:Panel ID="ResourceWrapper" runat="server">
            <asp:Label ID="AgentLabel" runat="server" Text='<%# Eval("Text") %>' />


  2. Peter
    Peter avatar
    6637 posts

    Posted 18 Jun 2012 Link to this post

    Hello Arvind,

    Please, try the following code and let me know if you have further questions:

    public partial class RadSchedulerWebForm1 : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
            RadScheduler1.ResourceHeaderTemplate = new ResourceHeaderTemplate();
        protected override void OnInit(EventArgs e)
            RadScheduler1.Provider = new XmlSchedulerProvider(Server.MapPath("~/App_Data/Appointments.xml"), true);
    public class ResourceHeaderTemplate : ITemplate
        public void InstantiateIn(Control container)
            Label textLabel = new Label();
            textLabel.ID = "AgentLabel";
            textLabel.DataBinding += new EventHandler(textLabel_DataBinding);
            Panel resourceWrapper = new Panel();
            resourceWrapper.ID = "ResourceWrapper";
        void textLabel_DataBinding(object sender, EventArgs e)
            Label resourceText = (Label)sender;
            resourceText.Text = ((SchedulerResourceContainer)resourceText.Parent.Parent).Resource.Text;       

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top