+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Finding control from AppointmentTemplate of RADScheduler control

Finding control from AppointmentTemplate of RADScheduler control

9 posts, 0 answered
  1. karan
    karan avatar
    1 posts
    Registered:
    01 Apr 2009
    14 Apr 2009
    Link to this post
    Hi,
     I am stuck at "finding control from AppointmentTemplate of RADScheduler" control.

    I have got a AppointmentTemplate having some set of controls :

     <AppointmentTemplate>
                    <b>Subject :</b><br />
                    <asp:Label ID="lblSub" runat="Server"             Text='<%#Eval("Subject")%>'></asp:Label><br />
                    <b>Start At :</b><asp:Label ID="LblStart" runat="Server"           Text='<%#Eval("Start")%>'></asp:Label><br />
                    <b>End At :</b><asp:Label ID="lblEnd" runat="Server" Text='<%#Eval("End")%>'></asp:Label><br />
                    <b>Applicant :</b><asp:Label ID="lblApplicant" runat="server" Text='<%#Eval("ApplicantID")%>'></asp:Label>
                    </AppointmentTemplate>

    Now I wanted to apply a condition before the appointment is shown into this control (at the time of binding the appointment) that is based on ApplicantID column which is binded with lblApplicant I want to format the appointment slot (some css apply or editing the property of slot like edit/delete=false).

    But when I am trying to find the control (lblapplicant) in the event like

    RadScheduler1_AppointmentDataBound
    _____________________________
      Label Lbl = (Label)e.Appointment.AppointmentControls[0].FindControl("lblApplicant");
            Response.Write("Applicant Id " + Lbl.Text);

    or

    RadScheduler1_TimeSlotCreated
    _________________________
     Label Lbl =(Label) e.TimeSlot.Control.Controls[0].FindControl("lblApplicant");
               Response.Write("Applicant Id " + Lbl.Text);

    I am fail to do show as I am only able to get the column property of default appointment property like (sublect,start,end..) but not the column property which is set for CustomAttributeNames.

    Please help me to either finding the lblApplicant control or geting the value of CustomAttributeNames column (except default columns).

    Thanks in Advance.


  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    15 Apr 2009
    Link to this post
    Hello Karan,

    We are a little confused if you use the default Sitefinity templates, or you have your own user controls with the RadScheduler control. Please let us know if this has anything in common with Sitefinity so we could assist you in a better way.

    Regards,
    Georgi
    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
    1 posts
    Registered:
    28 Aug 2009
    14 Sep 2009
    Link to this post
    how to do a findcontrol inside a RadScheduler?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    14 Sep 2009
    Link to this post
    Hi SKS,

    It depends on for which control you are looking for. You can use Control.FindControl Method. Sample code is shown below:

    protected void RadScheduler1_PreRender(object  sender, EventArgs e) 
       RadCalendar popupCalendar = RadScheduler1.FindControl("SelectedDateCalendar"as RadCalendar; 
        


    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Richard
    Richard avatar
    2 posts
    Registered:
    01 Sep 2010
    03 Jun 2011
    Link to this post
    OK... so I'm trying the code you listed with the RadScheduler component 'Pre_Render' event.

    However, it still doesn't find the control.  How can I find an updatepanel control embedded in the
    <AdvancedEditTemplate>?

    Please see the code that I'm attempting below:

     

     

    Protected Sub RadScheduler1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles

    RadScheduler1.PreRender

     

     

     

    Dim dvSql As Data.DataView = DirectCast(Me.SqlDataSource2.Select(DataSourceSelectArguments.Empty), Data.DataView)

     

     


    Dim
    updPanel As UpdatePanel = New UpdatePanel

     

     

    updPanel =

     

    DirectCast(Me.RadScheduler1.FindControl("updPanelUsers"), UpdatePanel)

     

     

     

     

    For Each drvSql As Data.DataRowView In dvSql

     

     

        Dim chkCheckbox As CheckBox = New CheckBox

     

     

        chkCheckbox.Text = drvSql("DisplayName").ToString  

        chkCheckbox.ID = drvSql(

     

    "UserID").ToString

     

         updPanel.ContentTemplateContainer.Controls.Add(chkCheckbox) 

     

    Next

    End Sub
    ----------------------------------
    When attempting to add the checkbox to the updPanel, it comes up with 'Object null'.
    Please help.

    Thank you.

     

     

  6. Richard
    Richard avatar
    2 posts
    Registered:
    01 Sep 2010
    06 Jun 2011
    Link to this post
    Anyone??
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Jun 2011
    Link to this post
    Hello Richard,

    Try subscribing for FormCreated and there you can call e.Container.FindControl("id")

    You can check the form mode using

    if (e.Container.Mode == SchedulerFormMode.AdvancedEdit || e.Container.Mode == SchedulerFormMode.AdvancedInsert)

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. rjb227s
    rjb227s avatar
    1 posts
    Registered:
    01 Apr 2009
    15 Jan 2012
    Link to this post
    This question seems to be left unanswered.  I too am attempting to get a control that is located in an 'appointmenttemplate' not a form template.  I have an image in my template that I want to retrieve and manipulate its source path.  The appointment object in the AppointmentDataBound event doesn't have anything for finding controls.

    Please help.  Here is my template:
    <AppointmentTemplate>
       <asp:Image runat="server" ID="imgProfile"/>
       <%# Eval("Subject") %>
    </AppointmentTemplate>
  9. Chris
    Chris avatar
    1 posts
    Registered:
    31 Jan 2012
    22 Feb 2012
    Link to this post
    You can do this from the AppointmentCreated event:

    protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
    {
    Label StatusLabel = (Label)e.Container.FindControl("StatusLabel");
    StatusLabel.Text = "Hello";
    }
Register for webinar
9 posts, 0 answered