Resource Attributes not serializing

23 posts, 0 answers
  1. Jose Granja
    Jose Granja avatar
    84 posts
    Member since:
    Oct 2009

    Posted 07 Jan 2011 Link to this post

    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 
  2. Jose Granja
    Jose Granja avatar
    84 posts
    Member since:
    Oct 2009

    Posted 07 Jan 2011 Link to this post

    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. 
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 10 Jan 2011 Link to this post

    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.
  5. Jose Granja
    Jose Granja avatar
    84 posts
    Member since:
    Oct 2009

    Posted 10 Jan 2011 Link to this post

    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
  6. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 13 Jan 2011 Link to this post

    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.
  7. Jose Granja
    Jose Granja avatar
    84 posts
    Member since:
    Oct 2009

    Posted 20 Jan 2011 Link to this post

    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
  8. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 24 Jan 2011 Link to this post

    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.
  9. Jose Granja
    Jose Granja avatar
    84 posts
    Member since:
    Oct 2009

    Posted 26 Jan 2011 Link to this post

    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
  10. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 07 Feb 2011 Link to this post

    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.
  11. Jesper Krejberg Petersen
    Jesper Krejberg Petersen avatar
    70 posts
    Member since:
    Dec 2006

    Posted 22 Feb 2011 Link to this post

    I'll put a vote on that one too.

    It's been driving me crazy :)

    Cheers /Jesper
  12. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 12 Mar 2011 Link to this post

    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!
  13. Phil Avella
    Phil Avella avatar
    2 posts
    Member since:
    Oct 2009

    Posted 17 Feb 2012 Link to this post

    This only work on the  OnClientAppointmentClick event. It does not work in the AdvanceForm (webservice) insert form.
  14. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 22 Feb 2012 Link to this post

    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.
  15. Marc-Antoine
    Marc-Antoine avatar
    6 posts
    Member since:
    Apr 2012

    Posted 07 May 2012 Link to this post

    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.
  16. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 09 May 2012 Link to this post

    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.
  17. Benny
    Benny avatar
    7 posts
    Member since:
    May 2012

    Posted 17 Mar 2013 Link to this post

    This is quite annoying. I hope this is fixed soon.
  18. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 21 Mar 2013 Link to this post

    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.
  19. Benny
    Benny avatar
    7 posts
    Member since:
    May 2012

    Posted 21 Mar 2013 Link to this post

    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.
  20. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 26 Mar 2013 Link to this post

    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.
  21. Benny
    Benny avatar
    7 posts
    Member since:
    May 2012

    Posted 09 Apr 2013 Link to this post

    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.
  22. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 12 Apr 2013 Link to this post

    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.
  23. Benny
    Benny avatar
    7 posts
    Member since:
    May 2012

    Posted 16 Apr 2013 Link to this post

    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.
  24. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 19 Apr 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017