Urgent help needed for User control with RadScheduler

8 posts, 0 answers
  1. Andy Green
    Andy Green avatar
    342 posts
    Member since:
    Aug 2008

    Posted 13 Jul 2009 Link to this post

    Hi

    I hope someone can answer fairly quickly.

    I have a Rad Scheuler control as a user conrtol I have set up 2 properteries ID and week Number, and create the control programatically based on the number of weeks, the web can display any number of grids from 1 to 12.

    This all works well.

    What I need to do is fill the grid with each weeks data, this means getting the Scheduler's ID and binding it to my recordset.

    This is my error when I try:
    Unable to cast object of type 'ASP.JobPlanScheduler' to type 'Telerik.Web.UI.RadScheduler'.

    And this is my code to find the scheduler control,

    Dim

     

    rsJobPlan = CType(Page.Master.FindControl("ctl00$cphContent$JobPlanWeek" & WeekCycle), RadScheduler)

     


    and this is the top section of my user contol vb file.

    Imports

     

    System.Data

     

    Imports

     

    System.Data.SqlClient

     

    Imports

     

    Telerik.Web.UI

     


    Andy
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 13 Jul 2009 Link to this post

    Hi Andy,

    Can you isolate the problem in a simple working demo project and send it to us via a support ticket?


    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andy Green
    Andy Green avatar
    342 posts
    Member since:
    Aug 2008

    Posted 14 Jul 2009 Link to this post

    Hi

    Whilst putting a simple version together, I found the problem, I was trying to convert my custom contol to a Rad scheduler, not the schedule control within my control, I was 1 level too high.

    Anyway I've now got a correct handle on the contol, but it wont fill with data. I know I'm on the control because I can change the background colour to suit the ID, I've tried with / and with out databind(), am I doing anything obviously wrong.

     

    Dim rsJobPlan As RadScheduler = CType(Page.Master.FindControl("ctl00$cphContent$cxJobPlan" & WeekCycle & "$rsJobPlan"), RadScheduler)

      

     

    With rsJobPlan

     .DataKeyField =

    "Session_ID"

     

     

     

    .DataStartField = "StartTime"

     

     

     

    .DataEndField = "EndTime"

     

     

     

    .DataSubjectField = "Location"

     

     

     

    .DataSource = ds

     

    .DataBind()

    .BackColor = Drawing.ColorTranslator.FromHtml(

    "#" & WeekCycle * 2 & WeekCycle * 2 & WeekCycle)

     

     

    End With

     

     

     

    I do have data - I have single stepped the code and I have 10 rows in the datasource.

     Andy

     

     

     

  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 14 Jul 2009 Link to this post

    Hello Andy,

    Which event do you use to bind RadScheduler? Have you tried this in Page_Load?


    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Andy Green
    Andy Green avatar
    342 posts
    Member since:
    Aug 2008

    Posted 14 Jul 2009 Link to this post

    Hi

    Yes I'm doing it in the page load of my user control, I pass in an ID as each user control instance has different data.
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
     
     
            LoadSessions(JobPlan_ID, Cycle)  
            Me.lblCycle.Text = "Week " & Cycle  
     
        End Sub  
     
     
        Protected Sub LoadSessions(ByVal JobPlan_ID, ByVal WeekCycle)  
     
            Dim jp As New JobPlan  
            Dim ds As Data.DataTable = jp.GetSessionByJobPlanWeekCycle(JobPlan_ID, WeekCycle)  
     
            Dim rsJobPlan As RadScheduler = CType(Page.Master.FindControl("ctl00$cphContent$cxJobPlan" & WeekCycle & "$rsJobPlan"), RadScheduler)  
     
            With rsJobPlan  
                .DataKeyField = "Session_ID" 
                .DataStartField = "StartTime" 
                .DataEndField = "EndTime" 
                .DataSubjectField = "Location" 
                .DataSource = ds 
                .DataBind()*****************************  
            End With  
     
        End Sub 

    If I break where I've shown *********** and look t the datasource I have rows.

    Andy
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 14 Jul 2009 Link to this post

    Hello Andy,

    Try calling Rebind() instead of DataBind(). If this does not help, please open a support ticket and send us a simple working demo project.

    Regards,
    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. Andy Green
    Andy Green avatar
    342 posts
    Member since:
    Aug 2008

    Posted 15 Jul 2009 Link to this post

    I've changed the scheduler to a radgrid and it works OK, in that the correct data is displayed, so the problem must be the way I'm doing the data binding on the scheduler control.

    I've found the problem, my data from the databse was last weeks, so whilst it still came back in the recordset, the scheduler decided not to show it.

    Just have to figure out how to get the scheduler to display a date range and that should be it.

    For now :-)
    Andy 

  9. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 15 Jul 2009 Link to this post

    Hello Andy,

    I am a bit confused as to what exactly the problem is. Is it that you have to navigate one week backwards to see the appointments. If yes, then you might need to set the SelectedDate property to the Start time of your first appointment from the record set.


    Greetings,
    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017