Getting appointments based om given id, - LINQ

2 posts, 0 answers
  1. Jill-Connie Lorentsen
    Jill-Connie Lorentsen avatar
    118 posts
    Member since:
    Nov 2008

    Posted 08 Jun 2012 Link to this post

    Hi!

    I am new to asp, so please excuse me if I don't express myself correctly.

    I have a RadScheduler with a Linq data source. I want to get appointments from the database based on a given id.

    In my DataClasses.dbml I have four tables and (for now) two stored procedures, GetProgram() and GetProgramById(int id). The user chooses the id from a checkboxlist, and I want to call the GetProgramById(int id) from codebehind. 

    In markup I have configured the RadScheduler with DataSourceID="ProgramDataSource". I try to set the data source property to the result of the GetProgramById(int id), but then I get an error saying that both DataSourceID and DataSource properties are set, and that I have to remove one of them. If I remove  DataSourceID="ProgramDataSource" from markup I can set DataSource=GetProgrambyID(int id), but then none of the appointments are updated to the database after closing the AdvancedEdit form of the scheduler.

    There must be a way to get a subset of the appointments, and to be able to edit them, so I would be greatful if anyone could help me find it.

    Thank you!

    Regards, Jill-Connie Lorentsen

    protected void RadListBoxTmp_ItemCheck(object sender, RadListBoxItemEventArgs e)
       {
     
           int id;        
           bool result = Int32.TryParse( e.Item.Value, out id);
           if ( e.Item.Checked && result)
           {
               var dataContext = new DataClassesDataContext();
               ProgramDataManager dataManager = 
                       new ProgramDataManager((SqlConnection)dataContext.Connection);
     
               var program = new List<GetProgramByIDResult>();
               program = dataManager.GetProgramByID(id);
     
                
               RadScheduler1.DataSource = program;
               RadScheduler1.Rebind(); 
           }
             
       }
  2. Plamen
    Admin
    Plamen avatar
    3048 posts

    Posted 13 Jun 2012 Link to this post

    Hello Jill,

     
    From the explanation of the issue it is a little complicated to provide a solution. That is why I prepared a sample project that contains a RadScheduler bound to Linq. Would you please review it let us know what is the code that should be added to it in order to reproduce the same unusual behavior that you are facing locally? This way we could inspect the issue and be more here helpful.
     

    Greetings,
    Plamen Zdravkov
    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