Displaying multiple fields with timeline

3 posts, 0 answers
  1. Marbry
    Marbry avatar
    123 posts
    Member since:
    Aug 2012

    Posted 20 Dec 2012 Link to this post

    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. Plamen
    Admin
    Plamen avatar
    2964 posts

    Posted 21 Dec 2012 Link to this post

    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.
  3. Marbry
    Marbry avatar
    123 posts
    Member since:
    Aug 2012

    Posted 21 Dec 2012 Link to this post

    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);
    }




Back to Top