WebScheduler, get Resource using ResourceID

1 reply. Last post: April 29, 2010 1:03 PM by Glenn Layaar
Tags :
  • (None)
Hi all,

I want to set disabled time for a resource when I found an event with some defined attributes. I do it in the WebScheduler_DataBound method. When an event is bound I can get the ResourceID from property WebSchedulerEvent.ResourceID, then I have to get the corresponding Resouce. Is there some get method to get the Resource or I have to cycle the WebScheduler.Resources collection?

Thanks in advance,

Vince.

Answers

In the server side, in order to retrieve the Resource detail using ResourceID you will need to iterate the Resources collection and match the ResourceID property. Here is the snippet to retrieve resource of an event in DataBound server side event handler using LINQ:

protected void WebScheduler1_DataBound(object sender, ISNet.WebUI.WebScheduler.WebSchedulerDataBoundDataArgs e)
{
if (e.Type == WebSchedulerObjectType.Event)
{
WebSchedulerResource res = (WebSchedulerResource)
(from r in WebScheduler1.Resources
where ((WebSchedulerResource)r).ResourceID == ((WebSchedulerEventBase)e.DataObject).ResourceID
select r).FirstOrDefault();

//Process the resource object
}
}

Unfortunately, WebScheduler do not provide any method to retrieve the resource using resource ID.

All Replies

In the server side, in order to retrieve the Resource detail using ResourceID you will need to iterate the Resources collection and match the ResourceID property. Here is the snippet to retrieve resource of an event in DataBound server side event handler using LINQ:

protected void WebScheduler1_DataBound(object sender, ISNet.WebUI.WebScheduler.WebSchedulerDataBoundDataArgs e)
{
if (e.Type == WebSchedulerObjectType.Event)
{
WebSchedulerResource res = (WebSchedulerResource)
(from r in WebScheduler1.Resources
where ((WebSchedulerResource)r).ResourceID == ((WebSchedulerEventBase)e.DataObject).ResourceID
select r).FirstOrDefault();

//Process the resource object
}
}

Unfortunately, WebScheduler do not provide any method to retrieve the resource using resource ID.

All times are GMT -5. The time now is 12:03 AM.
Previous Next