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

Displaying multiple fields with timeline

2 Answers 59 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Marbry
Top achievements
Rank 1
Marbry asked on 20 Dec 2012, 04:39 PM
I have data that relates values assigned to discrete date ranges.  Each range is identified by a combination of up to 6 different fields that need to be displayed with the range.

These are all in the primary datasource for the scehduler.  The obvious way would seem to be to simply group the rows by the additional fields so that I get something like,

field1value    field2value    field3value    field4value    __________ timeline ___________
field1value    field2value    field3value    field4value    __________ timeline ___________
field1value    field2value    field3value    field4value    __________ timeline ___________

However, I don't see any straightforward way to accomplish this.  The only thing I can see to do would be to take a roundabout way and create a second data source with the same data and a composite key formed from those additional fields and a foreign key back to the primary.  Add that as a resource, then group by the composite key.

Of course this would dump it all into a single column and leave it without proper headers, not exactly ideal.

Is there a better way to accomplish that?

2 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 21 Dec 2012, 10:46 AM
Hello Marbry,

 
The only way to achieve such appearance of RadScheduler I could think of is to use ResourceTemplates as in our demo and generate the fields in these templates in from the ResourceHeaderCreated event.

Hope this will work for you.

Regards,
Plamen
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
Marbry
Top achievements
Rank 1
answered on 21 Dec 2012, 03:50 PM
Ah, I see.  I think that will work.

I added the ResourceHeaderTemplate containing a table.
<ResourceHeaderTemplate>
    <asp:Table ID="tblRowHeader" runat="server" style="width: 100%; height: 100%;" BorderStyle="Solid" BorderWidth="1px" CellPadding="0" CellSpacing="0" GridLines="Both">
    </asp:Table>
</ResourceHeaderTemplate>

Then used the delimited values in the ResourceType to build the contents of the table in the header template.
protected void targets_ResourceHeaderCreated(object sender, ResourceHeaderCreatedEventArgs e)
{
    Table tbl = (Table)e.Container.FindControl("tblRowHeader");
    string[] values = Regex.Split(e.Container.Resource.Key.ToString(), "~");
     
    TableRow row = new TableRow();
 
    for (int i = 0; i < values.Length; i++)
    {
        TableCell cell = new TableCell();
        cell.Text = values[i];
        row.Cells.Add(cell);
    }
 
    tbl.Rows.Add(row);
}




Tags
Scheduler
Asked by
Marbry
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Marbry
Top achievements
Rank 1
Share this question
or