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

Noob trying to find my way

11 Answers 70 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 31 Oct 2011, 08:21 PM
Hi, I'm trying to implement the Rad Scheduler control for an application I'm writing and I've had an odd issue I don't understand.

I'm trying to bind to a list of objects (c# & asp.Net 4.0) and I started getting the error:

DataKeyField, DataSubjectField, DataStartField and DataEndField are required for databinding


So I think I fixed that by assigning values to the listed requirements. Then I started having trouble with my datasource and have now remarked out the entire section that binds the control to deal with that separately.

Now, even with no binding happening, I still get this error. This didn't seem to happen at first - I was getting a blank schedule before if I didn't bind so I'm not sure why I get this error now. It also happens before any of my code on that particular page executes.

Any ideas to get me back on track? Thanks!

11 Answers, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
answered on 31 Oct 2011, 10:32 PM
Ok, I have made a little progress, but I'm still seeing this error before my databinding code even executes.
I have the following in a Load event of a page:

        IEnumerable<ObjectTemplate> MyList = ot.GetList();

        RadScheduler1.DataSource = MyList;
        RadScheduler1.DataKeyField = "booking_id";
        RadScheduler1.DataStartField = "Start_Time";
        RadScheduler1.DataEndField = "End_Time";
        RadScheduler1.DataSubjectField = "lsndescrip";

        RadScheduler1.DataBind();

I have a breakpoint on the RadScheduler1.DataSource line but I never hit it. Before that code is reached I get the following:

DataKeyField, DataSubjectField, DataStartField and DataEndField are required for databinding


So do I need to specify these in the markup instead? Or got any other hints? Thanks!

Matt
0
Matt
Top achievements
Rank 1
answered on 01 Nov 2011, 12:06 AM
Well I made it through my last issue by specifying the DataKeyField, DataStartField, DataEndField, and DataSubjectField in the markup.

Now, when I bind to my object, I get an error that what I specified in markup as the DataKeyField cannot be found in my object. But I can see it's there when I'm drilling down in the debugger (see attached screen capture).

Can I even do something like this? I thoguht from what I read I could, but obviously it's not working for me. I'm hoping I'm close. Can anyone here tell? Thanks!

Matt
0
Stuart Hemming
Top achievements
Rank 2
answered on 01 Nov 2011, 12:29 AM
Matt,

I'm taking a flier here, but the casing you use in the markup doesn't match the casing in the screenshot.

I could be completely wrong about this but...

-- 
Stuart
0
Matt
Top achievements
Rank 1
answered on 01 Nov 2011, 04:49 PM
Thanks for the suggestion. I see what you are saying for the field names other than booking_id and have corrected those, but I still get the error for booking_id.

I think for now I'm just going to build a DataTable on the fly to just get this working, but I'd still love to be able to figure out how to bind directly to our data objects instead if there are any other suggestions.

Matt

Edit: while not very elegant, this worked. It will have to do for now!
0
Stuart Hemming
Top achievements
Rank 2
answered on 02 Nov 2011, 08:51 AM
Matt, FWIW, binding to Data Objects does work; we do it.

We get our data back as objects via WCF and bind it with no problem.

Can you generate a standalone project showing the problem?

I've asked 'cos that's what the boys and girls at telerik towers will ask you to do and, I have found, that trying to generate such a project will help you identify the real cause of the problem.

-- 
Stuart
0
Peter
Telerik team
answered on 03 Nov 2011, 09:16 AM
Hello,

@Matt, you can download a standalone sample with various data sources, including ObjectDataSource from this code library link and use it as reference.

@Stuart, thank you for looking into this case.

I hope this helps.

Kind regards,
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
Matt
Top achievements
Rank 1
answered on 03 Nov 2011, 05:56 PM
Thanks for the replies. I think my problem was that the object are new .Net 4.0 dynamic objects. I bet I can make it work by casting to a more traditional object with static properties. I'm going to try and get something like that going today.

PS - downloaded the samples, but they don't build. Is there something specific I need to do to make them build & run?

Thanks!
0
Matt
Top achievements
Rank 1
answered on 04 Nov 2011, 06:43 PM
Thanks, I think that object provider example is pretty similar to what I need to do. But there are a few things that aren't clear to me in this.

How/where does a custom provider need to be specified? Web.config? Control Markup? Both? Anywhere else?
What are the required methods in a provider?

FYI, I only need to make the scheduler control read-only.

Thanks again!
0
Peter
Telerik team
answered on 08 Nov 2011, 06:14 PM
Hi Matt,

The web.config of the sample is for .NET 4.0 (VS 2010). In addtion, you need to add a reference to the Telerik.Web.UI assembly. Let me know if you still experience problems.


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
Matt
Top achievements
Rank 1
answered on 08 Nov 2011, 08:12 PM
Thanks. I'm well into creating my own provider now, and have a question about that.
I'm working with ski instructor data to display their schedules to them. My datasource is objects that get returned from a DAL that talks to a COM object.
It seems to be coming together, but I'm a little confused on how to implement the GetResourceTypes and GetResourcesByType methods of my provider.

When this control is seen in my application, the user (instructor) has logged in already. So I'm dealing with a single resource type (instructor) as well as a single resource (this instructor)  at this point. How should I implement that in my GetResourceTypes and GetResourcesByType methods? Thanks again!

To clarify, my data comes back with the field we use to track the resources always set to the same value. So for my instructor login, I get all "MATTB" in my resource column. It's possible we may expand this in the future to support managers looking at multiple schedules at once, but for now it's just a single instructor looking at their own schedule.

Edit to add: I can now make my project run but I'm not seeing my appointments. Data is being fetched, but I think it's probably my implementation of resources that is making thing not show up.

Matt
0
Peter
Telerik team
answered on 11 Nov 2011, 03:31 PM
Hi Matt,

Please, refer to the Implementing A Provider help topic.

If you continue to experience problems, I recommend you open a support ticket and send us a simple working demo of the issue.


Kind Regards, 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
Tags
Scheduler
Asked by
Matt
Top achievements
Rank 1
Answers by
Matt
Top achievements
Rank 1
Stuart Hemming
Top achievements
Rank 2
Peter
Telerik team
Share this question
or