search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Displaying Group Availability of child element in parent control in asp.net webforms

Asked by Prakash
3 years ago.

Hi Team,

I wanted to displaying Group Availability of child element in parent control in asp.net webforms. To show total of booked room and available room. Like attached image in preview which already exists in javascript.

Answer posted by Dan Letecky [DayPilot]
3 years ago.

This is possible but you'll need to calculate the values yourself because there is no API to get a list of events for the specified time range in the ASP.NET WebForms version.

Comment posted by Prakash
3 years ago.

Hi Team,
Thanks for your quick response, we have calculated value, but we are not able to display it in parents area section. May I know how we can assign it to parent control. Please specify event to assign value to parent area and
How to assign it using which method/ property.

Comment posted by Dan Letecky [DayPilot]
3 years ago.

You need to use BeforeCellRender event handler and identify the cell using e.Start (cell start date/time) and e.ResourceId (the resource id).

You can find the Resource object using ResourceCollection.FindById() method if needed:

protected void DayPilotScheduler1_BeforeCellRender(object sender, DayPilot.Web.Ui.Events.BeforeCellRenderEventArgs e)
{
  Resource r = DayPilotScheduler1.Resources.FindById(e.ResourceId);
}

In order to prevent performance problems (BeforeCellRender is called for every cell), you'll need to precalculate the values outside of BeforeCellRender and save them in a separate property, e.g. a Map with a key built from a combination of cell start date and resource id (id of the parent).

Map values = new Map();

// ...

values[start.ToString() + resourceId] = "" + calculatedValue;

In BeforeCellRender, you'll read the values from that Map and set e.Html accordingly.

protected void DayPilotScheduler1_BeforeCellRender(object sender, DayPilot.Web.Ui.Events.BeforeCellRenderEventArgs e)
{
  e.Html = values[e.Start.ToString() + e.ResourceId];
}
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.