Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity Older Versions (3.x): Bugs & Issues > Finding control from AppointmentTemplate of RADScheduler control

Finding control from AppointmentTemplate of RADScheduler control

  • karan avatar

    Posted on Apr 14, 2009 (permalink)

    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.


    Reply

  • Georgi Georgi admin's avatar

    Posted on Apr 15, 2009 (permalink)

    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.

    Reply

  • SKS avatar

    Posted on Sep 14, 2009 (permalink)

    how to do a findcontrol inside a RadScheduler?

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Sep 14, 2009 (permalink)

    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.

    Reply

  • Richard avatar

    Posted on Jun 3, 2011 (permalink)

    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.

     

     

    Reply

  • Richard avatar

    Posted on Jun 6, 2011 (permalink)

    Anyone??

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Jun 7, 2011 (permalink)

    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

    Reply

  • Posted on Jan 14, 2012 (permalink)

    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>

    Reply

  • Chris avatar

    Posted on Feb 21, 2012 (permalink)

    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";
    }

    Reply

  • Register for webinar
Skip Navigation LinksHome / Developer Network / Forums / Sitefinity Older Versions (3.x): Bugs & Issues > Finding control from AppointmentTemplate of RADScheduler control