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

Resource Attributes not serializing

22 Answers 151 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jose Granja
Top achievements
Rank 1
Jose Granja asked on 07 Jan 2011, 06:07 PM
Hi,

I have my scheduler binded through web service. This part was working ok in the Q2 but then I updated to the Q3 and it's not working properly anymore.

I add an Attribute to my resources, say "X" for example and in the get resources from the web service I do the following:

Resource.Attributes["X"] = 1

when I get this Resource in the scheduler all the attributes dissapear. I don't know if that's normal or not. I use attributes to send extra information on the appointments and it works fine.

any ideas? is it a bug? or a normal behaviour? As I told you it was working fine for the Q2. This attribute [NonSerializedInControlState] may be preventing it from serialize?

regards,

jose 

22 Answers, 1 is accepted

Sort by
0
Jose Granja
Top achievements
Rank 1
answered on 07 Jan 2011, 06:16 PM
I noticed that the Resource.cssClass doesn't get serialized as well but looking at the ResourceData it's not there so I guess is normal. 
0
Peter
Telerik team
answered on 10 Jan 2011, 03:01 PM
Hi Jose Granja,

Starting with the Q3 2010 release RadScheduler provides a neater way to send additional information to the provider. Please, review this help topic:
http://www.telerik.com/help/aspnet-ajax/sending_additional_information_to_the_provider.html


Regards,
Peter
the Telerik team
Browse the vast support resources we have to jump start 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
Jose Granja
Top achievements
Rank 1
answered on 10 Jan 2011, 03:18 PM
Yes I'm using it but what I'm doing here is sending additional info from the provider! for every resource I need more information so the Attributes field seems the best place to put the info in.

regards,

jose
0
Peter
Telerik team
answered on 13 Jan 2011, 05:35 PM
Hello Jose,

I am not sure what exactly your implementation is. Can you paste the relevant code here? Even better, open a support ticket and send us a simple working demo.


Regards,
Peter
the Telerik team
Browse the vast support resources we have to jump start 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
Jose Granja
Top achievements
Rank 1
answered on 20 Jan 2011, 12:28 PM
my implementation is very simple... I add in each resource an attribute like this:

Resource.Attributes["foo"] = 1

when I want to ge this attribute from the client it is not there! It hasn't been serialized! I'm using webservice binding!

It is very difficult to provide a working sample, can you just try to put an attribute like that in the sample code? You'll see it want get serialized... It works fine when I send attributes in the appointments but not in the resources. I'm quite sure it is a bug

could you possible check? sorry for the late reply I'm really busy at the moment.

kind regards,

jose
0
Peter
Telerik team
answered on 24 Jan 2011, 09:36 AM
Hi Jose,

I see what you mean. Thanks for clarifying.

You made a valid point. This is not a bug, but rather a limitation of RadScheduler. I will log your request and we will consider implementing it for the future.


Greetings,
Peter
the Telerik team
Browse the vast support resources we have to jump start 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
Jose Granja
Top achievements
Rank 1
answered on 26 Jan 2011, 07:22 PM
Hi,

thank for the quick reply... The only thing that surprises me is that this was working before! On the previous release it was working and I was using it. When I upgrade it to the Q3 2010 it just stopped serialiazing the resources attributes! Could you confirm that please? 

kind regards,

jose
0
Peter
Telerik team
answered on 07 Feb 2011, 04:06 PM
Hello Jose,

This a very interesting case. I have tracked the history of the source code of RadScheduler and indeed, I was able to see some changes (mainly for refactoring) that could be causing this inconsistency.

For the time being, I cannot commit to reverting to the previous behavior, but we will consider it.

Please, accept our apologies for any inconvenience caused by this.

Kind regards,
Peter
the Telerik team
Browse the vast support resources we have to jump start 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
Jesper Krejberg Petersen
Top achievements
Rank 2
answered on 22 Feb 2011, 11:55 PM
I'll put a vote on that one too.

It's been driving me crazy :)

Cheers /Jesper
0
Peter
Telerik team
answered on 12 Mar 2011, 02:41 PM
Hi guys,

Today, I began 'fixing' this bug, but discovered that there isn't really a problem. :) Here is a simple demo to illustrate that the resource attributes render on the client and can be accessed as expected:

MyDbSchedulerProvider.cs
private IEnumerable<Resource> LoadTeachers() 
    
        List<Resource> resources = new List<Resource>(); 
    
        using (DbConnection conn = OpenConnection()) 
        
            DbCommand cmd = DbFactory.CreateCommand(); 
            cmd.Connection = conn; 
            cmd.CommandText = "SELECT [TeacherID], [Name], [Phone] FROM [DbProvider_Teachers]"
    
            using (DbDataReader reader = cmd.ExecuteReader()) 
            
                while (reader.Read()) 
                
                    Resource res = new Resource(); 
                    res.Type = "Teacher"
                    res.Key = reader["TeacherID"]; 
                    res.Text = Convert.ToString(reader["Name"]); 
                    res.Attributes["Phone"] = Convert.ToString(reader["Phone"]); 
                    resources.Add(res); 
                
            
        
    
        return resources; 
    }

RadSchedulerWebServiceCustomProvider.aspx
function OnClientAppointmentClick(sender, args) {            
          alert("Phone: " + args.get_appointment().get_resources().getResourceByType("Teacher").get_attributes().getAttribute("Phone")); 
      }

Please, test the sample and let me know if I have misunderstood the core of the problem.


Regards,
Peter
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Phil Avella
Top achievements
Rank 1
answered on 17 Feb 2012, 10:20 PM
This only work on the  OnClientAppointmentClick event. It does not work in the AdvanceForm (webservice) insert form.
0
Ivana
Telerik team
answered on 22 Feb 2012, 08:38 PM
Hello Phil,

We have tested this scenario and indeed  the attributes are lost after the serialization.  We will do some more research on this matter so that we will be certain of the scenario in which this issue is replicated.

If you have further questions regarding this matter, I would like to ask you to continue our conversation in the support thread you have started.

All the best,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Marc-Antoine
Top achievements
Rank 1
answered on 07 May 2012, 10:45 AM
Hello !

I have the same problem ; DataAttributes disapears after serialization but juste on server side.

Do you think you'll resolve the problem soon ?

Thank you,

Marc-Antoine.
0
Peter
Telerik team
answered on 09 May 2012, 04:41 PM
Hi Marc-Antoine,

We will log the issue for consideration, but it is not in our immediate to-do-list so we won't be able to dedicate resources on it any time soon.

All the best,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Benny
Top achievements
Rank 1
answered on 17 Mar 2013, 08:28 PM
This is quite annoying. I hope this is fixed soon.
0
Plamen
Telerik team
answered on 21 Mar 2013, 08:40 AM
Hi Benny,

 
Would you please elaborate a little bit what is the exact scenario you are trying to achieve and in which event are you  trying to get the attributes so we could inspect the issue once again and be more helpful?

Kind regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Benny
Top achievements
Rank 1
answered on 21 Mar 2013, 09:15 AM
I've implemented the ability to have the user select / deselect resources client side. Depending on the selection appointments are shown or not. My resources have some custom attributes (a color for example if more than one resource is selected) which I also need client side.

It would have been great to have one 'source' for my resources. The onSchedulerDataBound client side event was my guess to retrieve the resources and update a necessary list with checkboxes and names of my resources if I didn't already have the resources. Resources are shown even when they have no appointments in the currently displayed time period.

Since I'm manipulating the scheduler client side I don't need to go to the server to retrieve additional appointments.

I've attached a sample of what I mean.
0
Plamen
Telerik team
answered on 26 Mar 2013, 09:46 AM
Hello Benny,

 
As far as I could understand the scenario it is similar to what it implemented in this on-line demo. Would you please let us know if you are trying to add some more functionality or your case is somehow different?

Regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Benny
Top achievements
Rank 1
answered on 09 Apr 2013, 12:59 PM
The demo you refer to retrieves the appointments whenever you click on a resource. While I retrieve all appointments for the entire displayed time period (day / week) and let the user select / deselect resources client side and I show / hide appointments accordingly. I don't go to the server every time to load a new list.
0
Boyan Dimitrov
Telerik team
answered on 12 Apr 2013, 07:15 AM
Hello,

Indeed you can hide some of your appointments on the client-side without performing a call to your web service or request to the server. The following example code shows how you can iterate through your RadScheduler appointment collection and hide an appointment based on a condition related to its resource text.
//markup code
<telerik:RadScheduler runat="server" ID="RadScheduler1">
       </telerik:RadScheduler>
       <telerik:RadButton ID="RadButton1" runat="server" Text="Click here to hide an appointment" OnClientClicked="Btn1ClientClicked" AutoPostBack="false"></telerik:RadButton>
//JavaScript
function Btn1ClientClicked(sender, args) {
    var $ = $telerik.$;
    var scheduler = $find("<%= RadScheduler1.ClientID %>");
    var appointments = scheduler.get_appointments();
    for (var i = 0; i < appointments.get_count() ; i++) {
         
        if (appointments.getAppointment(i).get_resources().getResource(0).get_text() == "your custom resource key") {
            $(appointments.getAppointment(i).get_element()).css("visibility", "hidden");
        }
    }
     
}

Kind regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Benny
Top achievements
Rank 1
answered on 16 Apr 2013, 06:57 AM
This is indeed possible, although I use the scheduler's appointment collection to insert / remove appointments whenever a resource is selected/unselected because then the appointments are redrawn and take up all the space they have available.

If you just make them visible / invisible the appointments that are displayed are not redrawn to take up all the necessary space.

Yet now we are offtrack and the issue still exists. When the scheduler calls GetResources and you query the resource collection of the scheduler client side no custom attributes are available.
0
Boyan Dimitrov
Telerik team
answered on 19 Apr 2013, 06:53 AM
Hello,

I am afraid that if you want to modify the appointments collection or filtering appointments based on specific resources or custom attributes, you have to do a request to the server every time when user selects/deselects a resource. In this case I would suggest following the pattern showed in our RadScheduler overview demo in order to filter your appointments based on the user's selection from the resource check boxes.


Regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
Jose Granja
Top achievements
Rank 1
Answers by
Jose Granja
Top achievements
Rank 1
Peter
Telerik team
Jesper Krejberg Petersen
Top achievements
Rank 2
Phil Avella
Top achievements
Rank 1
Ivana
Telerik team
Marc-Antoine
Top achievements
Rank 1
Benny
Top achievements
Rank 1
Plamen
Telerik team
Boyan Dimitrov
Telerik team
Share this question
or