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

Urgent help needed for User control with RadScheduler

7 Answers 94 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Andy Green
Top achievements
Rank 2
Andy Green asked on 13 Jul 2009, 01:14 PM
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

7 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 13 Jul 2009, 02:18 PM
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.
0
Andy Green
Top achievements
Rank 2
answered on 14 Jul 2009, 09:06 AM
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

 

 

 

0
Peter
Telerik team
answered on 14 Jul 2009, 10:31 AM
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.
0
Andy Green
Top achievements
Rank 2
answered on 14 Jul 2009, 10:52 AM
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
0
Peter
Telerik team
answered on 14 Jul 2009, 04:20 PM
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.
0
Andy Green
Top achievements
Rank 2
answered on 15 Jul 2009, 07:21 AM
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 

0
Peter
Telerik team
answered on 15 Jul 2009, 11:12 AM
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.
Tags
Scheduler
Asked by
Andy Green
Top achievements
Rank 2
Answers by
Peter
Telerik team
Andy Green
Top achievements
Rank 2
Share this question
or