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

Template and DataBinding

13 Answers 647 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
rgf21
Top achievements
Rank 1
rgf21 asked on 13 Feb 2008, 11:56 AM
Hi. I have this code:

        <telerik:RadScheduler ID="RadScheduler1" runat="server" Culture="Portuguese (Portugal)" 
            Height="440px" SelectedView="WeekView" Skin="Web20" Width="751px" DayEndTime="1.00:00:00" DayStartTime="06:00:00" OverflowBehavior="Scroll" ShowFooter="False" ShowViewTabs="False" AllowDelete="True" AllowEdit="True" AllowInsert="True" DataEndField="Fim" DataKeyField="ID" DataSourceID="SqlAulas" DataStartField="Inicio" DataSubjectField="Assunto" FirstDayOfWeek="Monday" LastDayOfWeek="Saturday" DataMember="DefaultView" EnableTheming="True" ShowAllDayRow="False" WorkDayEndTime="23:00:00" WorkDayStartTime="06:00:00" EnableCustomAttributeEditing="True" ShowMonthlyColumnHeader="False">  
           <ResourceTypes> 
                <telerik:ResourceType DataSourceID="SqlSessoes" ForeignKeyField="sessao_id" KeyField="id" 
                    Name="Tipo" TextField="descricao" /> 
                <telerik:ResourceType DataSourceID="SqlFormadores" ForeignKeyField="formador_id" 
                    KeyField="user_id" Name="Formador" TextField="nome" /> 
                <telerik:ResourceType DataSourceID="SqlUFs" ForeignKeyField="uf_id" KeyField="ID" 
                    Name="UF" TextField="Designacao" /> 
            </ResourceTypes> 
            <InlineInsertTemplate> 
   <asp:TextBox  
       ID="TitleTextBox" 
       runat="server" 
       Text='<%# Bind("Assunto") %>' 
       Width="90%" 
       TextMode="MultiLine" 
       Height="20px">  
   </asp:TextBox><br /> 
                   <radCb:RadComboBox ID="RadComboBox5" runat="server" DataMember="DefaultView" DataSourceID="SqlFormadores" 
            DataTextField="nome" DataValueField="user_id" Skin="Default" SkinsPath="~/RadControls/ComboBox/Skins" 
            Value='<%# Bind("formador_id") %>' Width="90px" AppendDataBoundItems="True">  
                       <Items> 
                           <radCb:RadComboBoxItem ID="RadComboBoxItem1" Text="Formador" runat="server" Selected="True" /> 
                       </Items> 
        </radCb:RadComboBox> 
        <br /> 
        <radCb:RadComboBox ID="RadComboBox4" runat="server" DataMember="DefaultView" DataSourceID="SqlSessoes" 
            DataTextField="descricao" DataValueField="id" Skin="Default" SkinsPath="~/RadControls/ComboBox/Skins" 
            Value='<%# Bind("sessao_id") %>' Width="90px" AppendDataBoundItems="True">  
            <Items> 
                <radCb:RadComboBoxItem ID="RadComboBoxItem2" runat="server" Text="Sessão" Selected="True" /> 
            </Items> 
        </radCb:RadComboBox> 
        <br /> 
        <radCb:RadComboBox ID="RadComboBox3" runat="server" DataMember="DefaultView" DataSourceID="SqlUFs" 
            DataTextField="Designacao" DataValueField="ID" Skin="Default" SkinsPath="~/RadControls/ComboBox/Skins" 
            Value='<%# Bind("uf_id") %>' Width="90px" AppendDataBoundItems="True">  
            <Items> 
                <radCb:RadComboBoxItem ID="RadComboBoxItem3" runat="server" Text="UF" Selected="True" /> 
            </Items> 
        </radCb:RadComboBox> 
        <br /> 
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("precenca") %>' Font-Names="Arial" Font-Size="Small" Text="Presenças" /><br /> 
<asp:CheckBox ID="CheckBox2" runat="server" Checked='<%# Bind("sumario") %>' Font-Names="Arial" Font-Size="Small" Text="Sumário" /><br /> 
<asp:CheckBox ID="CheckBox3" runat="server" Checked='<%# Bind("ocorrencias") %>' Font-Names="Arial" Font-Size="Small" Text="Ocorrências" /><br /> 
<asp:CheckBox ID="CheckBox4" runat="server" Checked='<%# Bind("visitada") %>' Font-Names="Arial" Font-Size="Small" Text="Visitada" /><br /> 
<asp:CheckBox ID="CheckBox5" runat="server" Checked='<%# Bind("realizada") %>' Font-Names="Arial" Font-Size="Small" Text="Realizada" /><br /> 
<asp:CheckBox ID="CheckBox6" runat="server" Checked='<%# Bind("substituida") %>' Font-Names="Arial" Font-Size="Small" Text="Substituida" /><br /> 
   <asp:LinkButton  
       ID="InsertButton" 
       runat="server" 
       CommandName="Insert">  
           <asp:Image  
               runat="server" 
               ID="insertImage" 
               ImageUrl="../Images/giscon/AppointmentEditOK.gif" 
               AlternateText="insert" /> 
           </asp:LinkButton> 
           <asp:LinkButton  
               ID="InsertCancelButton" 
               runat="server" 
               CausesValidation="False" 
               CommandName="Cancel">  
                   <asp:Image  
                       runat="server" 
                       ID="Image3" 
                       ImageUrl="../Images/giscon/AppointmentEditCancel.gif" 
                       AlternateText="cancel" /> 
           </asp:LinkButton> 
 
</InlineInsertTemplate>   
<AppointmentTemplate> 
<%# Eval("Assunto") %><br /> 
<%# Eval("sessao_id") %> 
 
        
</AppointmentTemplate>   
 
 
        </telerik:RadScheduler> 

Everithing shows fine except the AppointmentTemplate that is giving me this error:  

DataBinding: 'Telerik.Web.UI.Appointment' does not contain a property with the name 'Assunto'.

But I have the Assunto in the DB.

Can you help me please?


thanks.

13 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 14 Feb 2008, 02:09 PM
Hi Ricardo,

Please, be advised that when binding template controls you need to bind them to names of appointment's properties, not to column names. Please, try modifying your code like this:

<%# Eval("Assunto") %>   --> <%# Eval("Subject") %>

Please, let us know how this works out for you.


Kind regards,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
License Developer
Top achievements
Rank 1
answered on 03 Oct 2008, 04:47 PM
This answer is correct, after changing my column name to 'Subject' it properly pulled my DataSubjectField Column that i indicated within the attributes of the telerik scheduler.
0
towpse
Top achievements
Rank 2
answered on 20 Nov 2009, 06:24 PM
I'm trying to solve a similar issue.

I am using the web service scheduler provider technique to get data from a web service and bind it to the scheduler control.

Here's my sample Control:

        <telerik:RadScheduler    ID="RadScheduler1"  
                                            runat="server"  
                                            Height="800px"  
                                            Skin="WebBlue" SelectedView="WeekView"  
                                            ShowFullTime="True"  
                                            StartInsertingInAdvancedForm="True"  
                                            MaximumRecurrenceCandidates="10000"  
                                            OnClientFormCreated="schedulerFormCreated" 
                                            OnResourcesPopulating="RadScheduler1_ResourcesPopulating"  
                                            DataEndField="End"  
                                            DataKeyField="ID"  
                                            DataRecurrenceField="RecurrenceRule"  
                                            DataRecurrenceParentKeyField="RecurrenceParentID" 
                                            DataStartField="Start"  
                                            DataSubjectField="Subject" 
                                            CustomAttributeNames="ControlScheduleType" 
                                            EnableCustomAttributeEditing="True" EnableResourceEditing="False"  ValidationGroup="RadScheduler1" > 
             
            <WebServiceSettings Path="SchedulerWebService.asmx"  
                ResourcePopulationMode="ServerSide" /> 
            
            <AppointmentContextMenuSettings EnableDefault="True" Skin="WebBlue" /> 
            <TimeSlotContextMenuSettings EnableDefault="true" /> 
             
            <advancedform maximumheight="550px" modal="True" enablecustomattributeediting="True" enableresourceediting="False" /> 
             
            <AppointmentTemplate> 
                <div class="rsAptSubject"
                    <%# Eval("Subject") %> 
                </div> 
                <%# Eval("Description") %> 
            </AppointmentTemplate> 
             
            <AdvancedEditTemplate> 
                <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" 
                    Subject='<%# Bind("Subject") %>' 
                    Description='<%# Bind("Description") %>'  
                    Start='<%# Bind("Start") %>' 
                    End='<%# Bind("End") %>' 
                    RecurrenceRuleText='<%# Bind("RecurrenceRule") %>' 
                    ControlScheduleType='<%# Bind("ControlScheduleType") %>' /> 
            </AdvancedEditTemplate> 
             
            <AdvancedInsertTemplate> 
                <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" 
                    Subject='<%# Bind("Subject") %>' 
                    Start='<%# Bind("Start") %>' 
                    End='<%# Bind("End") %>' 
                    Description='<%# Bind("Description") %>' 
                    RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'  
                    ControlScheduleType='<%# Bind("ControlScheduleType") %>'/> 
            </AdvancedInsertTemplate> 
              
            <TimelineView UserSelectable="false" /> 
              
        </telerik:RadScheduler> 

EDIT If I don't provide a CustomAttributeName string for CustomAttributeNames="" I get a message 

DataBinding: 'Telerik.Web.UI.Appointment' does not contain a property with the name 'ControlScheduleType'

Which makes sense because of this line

ControlScheduleType='<%# Bind("ControlScheduleType") %>'/>


If I provide CustomAttributeNames="ControlScheduleType" I get

Object reference not set to an instance of an object


My provider methods currently deal with the Telerik Appointment Class.
i.e 

public override void Insert(RadScheduler owner, Appointment appointmentToInsert) 
public override IEnumerable<Appointment> GetAppointments(RadScheduler owner) 


Of course the Appointment class does not have a ControlScheduleType property.

I thought then I could make my own class that extends from Appointment and include my extra information.

Public MyClass : Appointment { 
        public ControlScheduleType { get {return _type;} } 


I then tried to replace the references to Appointment in my provider class with MyClass but I cannot compile it after doing that because I have not properly implemented Insert and Get method that take in or return Appointment objects.

public override void Insert(RadScheduler owner, MyClass appointmentToInsert) 
public override IEnumerable<MyClass> GetAppointments(RadScheduler owner) 


Am I thinking about this correctly or am I missing something?
I thought since MyClass is an Appointment it should satisfy the interface implementation.

I followed the steps to add a combo box to my advance form using this KB article. Now I just need to bind the form to the MyClass : Appointment object that I am using to bind the schedule.

THanks for any help.
0
towpse
Top achievements
Rank 2
answered on 24 Nov 2009, 07:54 PM
I have the follwoing custom controls in the advanced form

               <asp:Panel runat="server" ID="AdvancedControlsPanel" CssClass="rsAdvMoreControls">  
                  
                        <label> 
                            Time Zone:  
                        </label> 
                        <%--TODO OnClientSelectedIndexChanged="Hide controls for Schedule Type. I.e start has no end?"  --%> 
                        <telerik:RadComboBox ID="cmbTimeZone" class="TimeZone" runat="server" Width="186px" DataTextField="DisplayName" DataValueField="TimeZoneId" Skin="WebBlue" /> 
                  
                        <label> 
                            Control:  
                        </label> 
                        <%--TODO OnClientSelectedIndexChanged="Hide controls for Schedule Type. I.e start has no end?"  --%> 
                        <telerik:RadComboBox ID="cmbControlScheduleType" class="Control" runat="server" Width="186px" DataTextField="Name" DataValueField="ControlScheduleTypeId" Skin="WebBlue" />                        
   
                </asp:Panel> 

I've added the following properties to the code behind of the adbacned form

        ///Control Type  
        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]  
        public int ControlScheduleType  
        {  
            get 
            {  
                return int.Parse(cmbControlScheduleType.SelectedValue);  
            }  
 
            set 
            {  
                // Store the selected country ID until we obtain the continent ID    
                _selectedControlScheduleType = value;  
            }  
        }  
 
        ///Time Zone Id  
        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]  
        public Guid TimeZoneId  
        {  
            get 
            {  
                return new Guid(cmbTimeZone.SelectedValue);  
            }  
 
            set 
            {  
                // Store the selected country ID until we obtain the continent ID    
                _selectedTimeZone = value;  
            }  
        } 

And I've created the methods to load up those drop down.

How do I get this data out of the advanced form in javascript? Are there any built in methods to make this easier or do I need to rely on jquery to look for these controls in the DOM?

EDIT:
I want the selected value of these drop downs before I send off to the web service.

function AppointmentWebServiceUpdating(sender, eventArgs) {  
    var info = eventArgs.get_schedulerInfo();  
    info.ScheduleType = 1; //TODO get from user selection  
    info.TimeZone = "9999O888-CDE6-449A-9105-4084B0AC24CE"; //TODO User selection  

Can anyone offer any advice?
0
towpse
Top achievements
Rank 2
answered on 24 Nov 2009, 09:10 PM
Oh and I can't use jquery class selectors becuase the telerik advacned form stuff overwrites all that stuff once it gets to the UI.
Please help. Thanks.
0
Peter
Telerik team
answered on 26 Nov 2009, 08:49 AM
Hi towps,

Please, review the second part of the following help topic:
http://www.telerik.com/help/aspnet-ajax/schedule_advancedformtemplate.html
-> How to use the advanced user controls in Client Side binding mode (Web Services)

You can download a working demo from here:
http://www.telerik.com/support/kb/aspnet-ajax/scheduler/sample-project-of-customizing-the-advanced-form-in-client-side-binding-mode-web-services.aspx

You are right - you need to use java script to access the controls in the advanced form.


All the best,
Peter
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.
0
towpse
Top achievements
Rank 2
answered on 02 Dec 2009, 09:33 PM
Having some binding troubles. Hope someone can help.

I have a combo box called cmbTimeZone on my advacned form.
                <asp:Panel runat="server" ID="AdvancedControlsPanel" CssClass="rsAdvMoreControls"
                 
                        <table id = "tblUserData"
                         
                            <tr> 
                                <td > 
                                    <label> 
                                        Time Zone: 
                                    </label> 
                                </td> 
                                <td class="rsTimePick"
                                        <telerik:RadComboBox  ID="cmbTimeZone"  
                                                                            OnItemDataBound="cmbTimeZone_TimeZoneDataBound"  
                                                                            OnClientItemDataBound="TimeZoneClientItemDataBound"  
                                                                            class="TimeZone"  
                                                                            runat="server"  
                                                                            Width="300" Height="150"   
                                                                            DataTextField="Display" DataValueField="Id"  
                                                                            Skin="WebBlue" /> 
                                </td> 
                            </tr> 
                         
                        </table> 
                 
                </asp:Panel> 


I have a property called TimeZoneId
        ///Time Zone Id 
        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)] 
        public Guid TimeZoneId 
        { 
            get 
            { 
                return new Guid(cmbTimeZone.SelectedValue); 
            } 
 
            set 
            { 
                _selectedTimeZone = value
                cmbTimeZone.SelectedValue = value.ToString(); 
 
            } 
        } 

I load it up accordingly based on this help page.

I tell the scheduler about a custom attribute called TimeZoneId
CustomAttributeNames="TimeZoneId"

And I tell it bind in the edit template
            <AdvancedEditTemplate> 
                <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" 
                    Subject='<%# Bind("Subject") %>' 
                    Description='<%# Bind("Description") %>'  
                    Start='<%# Bind("Start") %>' 
                    End='<%# Bind("End") %>' 
                    TimeZoneId='<%#Bind("TimeZoneId") %>' 
                    RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'/> 
            </AdvancedEditTemplate>      

When I run my app I get Object not set to an instance of an object and it breaks on this line <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit"

When I return my appointments to the scheduler I make sure that the custom attribute time zone Id has a value for each appointment
                    appointment.Attributes.Add("TimeZoneId", schedule.TimeZoneId.ToString()); 
Then return List<Appointment>


What have I missed? I'll have to scan that doc again but I think I have everything.

0
Peter
Telerik team
answered on 07 Dec 2009, 01:54 PM
Hello towps,

I suspect the problem is related to using guid as type for the TimeZoneId property. Can you try using string instead and let us know how it goes.


Cheers,
Peter
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.
0
Daniel Hodgin
Top achievements
Rank 1
answered on 06 Apr 2010, 04:31 AM
I had this problem with a property trying to use a Guid type as the return

changing it to use strings fixed the problem

I have a radcomboBox control rcbGroomer for my "Groomer" which is just an asp.net membership user + custom profile attributes
trying to make the property return a Guid gave me the same error as above, changing to string fixed it

        [Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
        public string SelectedGroomer
        {
            get
            {
                return rcbGroomers.SelectedValue;
            }

            set
            {
                rcbGroomers.SelectedValue = value.ToString();
            }
        }
0
rajesh
Top achievements
Rank 1
answered on 04 Dec 2010, 10:35 AM
Hi sir,
i inserted a radcombo box in advance form template ...when i try to bind it with datasource...it is saying  DataBinding: 'Telerik.Web.UI.Appointment' does not contain a property with the name 'LeaveTypeID'. cant we bind custom properties in advance form template to data source
if we can than please provide a demo for that ...

thank you 


 
0
Peter
Telerik team
answered on 09 Dec 2010, 09:45 AM
Hi rajesh,

Please, refer to the following kb articles:

Related Load on Demand RadComboBoxes in the advanced form of RadScheduler

Implement related RadComboBox controls in the advanced form

I hope they help you get started.

Regards,
Peter
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Osvaldo
Top achievements
Rank 1
answered on 08 May 2015, 10:51 PM

Please I need to create a custom Appointment class but I don't know how, I'm creating a scheduler with RadScheduler, the provider it's a DataBase I'm using a Web Service... I want to change and add properties in the Insert and Edit form and save it in the DataBase. I read some post from here and the documentation but I'm still knowless about what I want to do... I hope you can help me.

Nota: Sorry about my english I'm a spanish speaker.

0
Hristo Valyavicharski
Telerik team
answered on 13 May 2015, 03:05 PM
Hi Osvaldo,

I have replied here: http://www.telerik.com/forums/custom-appointment-web-service-binding-and-database-provider

Regards,
Hristo Valyavicharski
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Scheduler
Asked by
rgf21
Top achievements
Rank 1
Answers by
Peter
Telerik team
License Developer
Top achievements
Rank 1
towpse
Top achievements
Rank 2
Daniel Hodgin
Top achievements
Rank 1
rajesh
Top achievements
Rank 1
Osvaldo
Top achievements
Rank 1
Hristo Valyavicharski
Telerik team
Share this question
or