Access Controls Inside Radscheduler Templates

5 posts, 1 answers
  1. Glenn Boothe
    Glenn Boothe avatar
    21 posts
    Member since:
    Jul 2008

    Posted 11 Feb 2009 Link to this post


    I am having trouble finding the proper syntax for getting controls inside Radschedulers InlineInsertTemplate (or any other template for that matter)  I have read the articles in the KB about accessing controls inside templates dealing with RadMenu but none specifically dealing with RadScheduler.

    I am trying to check the value of a textbox in my template on appointment insert to see if it has a value or not.  If not, I want to be able to insert some sort of default value into the appointment.  Whenever I try to access controls in the inline edit using schedule.FindControl("myTextBox") or schedule.NamingContainer.FindControl("myTextBox") I am met with an error

    Object reference not set to an instance of an object.

    Here is an example of the code I am trying to use.

        Protected Sub schedule_AppointmentInsert(ByVal sender As ObjectByVal e As Telerik.Web.UI.SchedulerCancelEventArgs) Handles schedule.AppointmentInsert  
            'Insert this dummy value into the textbox when appointment is being inserted  
            CType(schedule.FindControl("TitleTextBox"), TextBox).Text = "YO" 
        End Sub 

    If anyone can help me out with this I would greatly appreciate it.

  2. Answer
    Peter avatar
    6637 posts

    Posted 13 Feb 2009 Link to this post

    Hi Glenn,

    One possible solution is to use RadTextBox and Custom Attributes. Handle the OnValueChanged client event of RadTextBox to store the value in a hidden fields control. Consider the following example:

     <telerik:RadScheduler ID="RadScheduler1" runat="server"     
            DataKeyField="ID" DataRecurrenceField="RecurrenceRule"   
            DataSourceID="AccessDataSource1" DataStartField="Start"   
            DataSubjectField="Subject" HoursPanelTimeFormat="htt"   
            onappointmentinsert="RadScheduler1_AppointmentInsert" > 
            <InlineInsertTemplate > 
                 <telerik:RadTextBox ID="RadTextBox2" Text='<%# Bind("Subject") %>' runat="server">  
                <telerik:RadTextBox ID="RadTextBox1" Text='<%# Bind("Description") %>' ClientEvents-OnValueChanged="OnValueChanged" runat="server">  
                <asp:LinkButton ID="insert1" runat="server" CommandName="Insert">insert</asp:LinkButton> 
        <script type="text/javascript">  
            function OnValueChanged(sender) {  
                var txbValue = document.getElementById("HiddenField1");  
                txbValue.value = sender.get_editValue();  
        <asp:HiddenField ID="HiddenField1" runat="server" /> 

     protected void RadScheduler1_AppointmentInsert(object sender, Telerik.Web.UI.SchedulerCancelEventArgs e)  
            if (HiddenField1.Value == String.Empty)  
                e.Appointment.Attributes["Description"] = "Yo";  

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. SKS
    SKS avatar
    32 posts
    Member since:
    Aug 2009

    Posted 14 Sep 2009 Link to this post

    how do i insert a datagrid inside a radscheduler appointment. and bind it to a datasource?
    y are these controls so complex.isnt their an easy way to customise these controls?
  4. drgorin
    drgorin avatar
    10 posts
    Member since:
    Aug 2012

    Posted 25 Mar 2010 Link to this post

    Using the OnValueChange event is extremely clever for getting a handle on the content of the textbox. I however have a slightly different situation and would appreciate some guidance or direction to a white paper.

    I have a page that host's  radscheduler called radscheduler.aspx.  I have a custom attribute called PatientName.  I have a Button control in my inlineedit template that calls a radwindow that host's a page called PatientLookUp.aspx.  PatientLookUp has a datagrid filled with thousands of patient's data.  I return the patient's name to a javascript function as a pparameter on radsceduler.aspx upon closing PatientLookUp.aspx.  While I have the inlineedit template still open, I would like to insert the returned patient's name into the textbox or the label whoch is databound to the custom attribute PatientName.  How do I get a reference to the textbox or label that is databound to the custom attribute PatientName.  Access on the client please not the server.

  5. Peter
    Peter avatar
    6637 posts

    Posted 29 Mar 2010 Link to this post

    Hello Gorin,

    We have replied to your support ticket suggesting two solutions to your requirement. I will post the one you said you prefer for community reference here:

    <script type="text/javascript"
           var textboxInTemplate = null; 
           function OnLoad(sender) { 
               textboxInTemplate = sender; 
           function setTextBoxInSchedulerTemplate() { 
               if (textboxInTemplate) 
                   textboxInTemplate.set_value("custom text here"); 
               textboxInTemplate = null; 
       <input id="Button1" type="button" value="set textbox value in inline template" onclick="setTextBoxInSchedulerTemplate()" /> 
       <telerik:RadScheduler runat="server" ID="RadScheduler1"
               <telerik:RadTextBox ID="RadTextBox1" runat="server" ClientEvents-OnLoad="OnLoad"

    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top