This is a migrated thread and some comments may be shown as answers.

how i can access AppointmentTamplete Controls in code behind File

4 Answers 130 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Muhammad ali
Top achievements
Rank 1
Muhammad ali asked on 06 Apr 2010, 11:28 AM

i m very Confuse, i have to find "chk" Control  in my Codebehind file

<A

 

ppointmentTemplate>

 

 

 

 

 

 

 

 

 

<asp:CheckBox ID ="chk" Text='<%#Eval("ID")%>' runat="server" CssClass="test" OnCheckedChanged="alert('dsfa');" />

 

 

 

 

<asp:Label ID="lblChanelID" runat="server" Text='<%#Eval("Subject")%>'></asp:Label>

 

 

 

 

</AppointmentTemplate>
basically i have provided checkbox in all my appointment, i want to track which apointment is checked by user and which apointment is not checked by user  for that purpose i have to get the referance of Check box that is inside the <AppointmentTemplate> so how i can acess controls that is  inside <AppointmentTemplete> and get it referance according to check box TEXT property;

thanks
Muhammad ali

 

 

 

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 08 Apr 2010, 01:06 PM
Hello Muhammad ali,

You can access the AppointmentTemplate checkbox control in ApponintmentCreated like this:

protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
   {
       CheckBox checkbox1 = (CheckBox)e.Container.FindControl("chk");
       checkbox1.Checked = true;       
   }



Kind regards,
Peter
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.
0
Muhammad ali
Top achievements
Rank 1
answered on 09 Apr 2010, 06:38 AM
actually i want to access appointmentTemplete Check box, when i click  button (on buttonClick Event), and that is outside the RadScheduler control





0
Muhammad ali
Top achievements
Rank 1
answered on 09 Apr 2010, 07:33 AM
Actually i want to get all appointment Check box status when i click a Button that is place outside the Scheduler
i.e

 <telerik:RadScheduler ID="RadScheduler1" runat="server" DataEndField="End"
        DataKeyField="ID" DataSourceID="ObjectDataSource1" DataStartField="Start"
        DataSubjectField="Subject" HoursPanelTimeFormat="htt"
         SelectedView="DayView"
        ColumnWidth="55px" ValidationGroup="RadScheduler1" MinutesPerRow="15" >

<AppointmentTemplate>
                       <asp:CheckBox ID ="chk" Text='<%#Eval("ID")%>' runat="server" OnCheckedChanged="GetRecords_Click" AutoPostBack="True" />
</AppointmentTemplate>
</telerik:RadScheduler>



<asp:Button ID="SaveAll" runat="server" Text="Save All" />



Code behind file:
when saveAll Click then i want to check  all appointment that which appointment Checkbox is Check and which one is unChecked,

    void SaveAll_Click(object sender, EventArgs e)
    {
      
    }

thanks
please Reply me as fast as Possible
Regarded as
 Muhammad ali
0
Veronica
Telerik team
answered on 12 Apr 2010, 05:22 PM
Hi Muhammad,

To be able to check which appointment is checked and which is not use this in the SaveAll_Click handler:

protected void SaveAll_Click(object sender, EventArgs e)
    {
        foreach (Appointment a in RadScheduler1.Appointments)
        {
            if (string.IsNullOrEmpty(a.Subject))
            {
                a.Subject = "No subject";
            }
            if (string.IsNullOrEmpty(a.Attributes["AppCheckedState"]))
            {
                a.Attributes["AppCheckedState"] = "False";               
            }
            Response.Write(a.Subject + " - " + a.Attributes["AppCheckedState"] + "</br>");
        }
    }

As you may see in the code above we are using a custom attribute with name AppCheckedState(in which we are keeping the status of the checkbox) and an AppointmentTemplate:

<telerik:RadScheduler ID="RadScheduler1" runat="server" CustomAttributeNames="AppCheckedState"
        EnableCustomAttributeEditing="true" OnAppointmentCreated="RadScheduler1_AppointmentCreated"
        OnAppointmentDataBound="RadScheduler1_AppointmentDataBound">
        <AppointmentTemplate>
            <asp:CheckBox ID="chk" Text='<%# Eval("Subject")%>' Checked='<%# Convert.ToBoolean(Eval("AppCheckedState"))%>'
                runat="server" OnCheckedChanged="chk_CheckedChanged" AutoPostBack="True" />
        </AppointmentTemplate>
    </telerik:RadScheduler>

You may see the full code in the attached .zip file.

Hope this helps.

Regards,
Veronica Milcheva
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.
Tags
Scheduler
Asked by
Muhammad ali
Top achievements
Rank 1
Answers by
Peter
Telerik team
Muhammad ali
Top achievements
Rank 1
Veronica
Telerik team
Share this question
or