Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 01, 2012 10:29 AM by westerdaled2
Mar 01, 2012 04:27 AM|LINK
I want to display a schedule for a sports league that will show 5 weeks of schedules that come up in the future. Instead of putting 5 datalists or grid controls on one aspx page for each and every week (with codebehind that supports each control tied to
its own datasource and set of ado objects), i'd rather just have one set of ado objects with one sql statement that encompass all 5 weeks of the data, but displaying it in one of the web controls is creating a barrier: how do i assign in the webform control
properties the headers template or the separator template a break when the next week of schedule is to be shown? Do I need a special sql statement in the Compute By or Rollup context to list this report style? Is a datalist or repeater better to use than one
of the grid controls?
Mar 01, 2012 04:40 AM|LINK
use nested repeater.... in first repeater weeks and in nested repeater schedule
Mar 01, 2012 01:12 PM|LINK
If you sort the data properly, you can use some code to have grouping. I use it regularly. It works for Repeater, ListView and GridView. I will explain for GridView. For the others, you can probably do the same trick yourself.
In GridView, make the first column a TemplateField. In the ItemTemplate, put a Panel, followed by what you want in the first Column.
Inside the Panel, put the group header, followed by </td></tr><tr><td>.
Give your page a private member to hold the current week number.
Handle RowDataBound of the GridView. In that, check the RowType.
If it is a Header, set the current week number to a default value that will never occur for real.
If it is a DataRow, use DataBinder.Eval to get the week number from e.Row.DataItem.
Compare it with the current week number. If these are the same, set the Visible of the Panel (use e.Row.FindControl to get it) to false. If they are different, set the Visible of the Panel to True.
If the schedule for each week always has the same number of lines, it is even easier. ListView already supports grouping on a set number of Items.
May 01, 2012 10:29 AM|LINK
This is similar to my problem. I have ordered my list data in a DataTable by week commencing so that I can group my SharePoint list items in a (html) table. I have populated a ListView but as you say this only works for grouping if I have fixed GroupItemCount
which I will not.
in the table below - note the table looked ok in preview & in html editor but when I posted the border is removed and 20;04/12 should be aligned with Task 1, Task 2 and Task 3
Looks like I will attempt your approach. Is there any help you could give my case / howtos as fairly new to these asp controls
Progress so far
Using my data source
DataTable dataSource = new DataTable();
I can produce the default 2 colum table with appropriate header columns by simply placing the following markup on the page (in a Web Part) and binding the datasource. looks ok
<asp:GridView ID="DataGridView" runat="server">
I have order the data in my DataTable by the DateTime fields: "W/C ASC"
Now I want to group my task actions horizonatally by the W/C (week commencing date), based on your intructions I have got this far
<asp:GridView ID="DataGridView" runat="server" OnRowDataBound="DataGridView_RowDataBound">
<asp:Panel ID="TimelineGroupPanel" runat="server">
How do I put in the group header....