Code Behind
protected void bindRepeater()
{
rptDays.DataSource = ResultsWrapper.Dates;
rptDays.DataBind();
}
protected void rptDays_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
DateTime date = Convert.ToDateTime(e.Item.DataItem);
LinkButton btnDateHeader = e.Item.FindControl("btnDateHeader") as LinkButton;
btnDateHeader.Text = date.ToShortDateString();
int status = Convert.ToInt32(rblReviewType.SelectedValue);
Label lblDayResultStats = e.Item.FindControl("lblDayResultStats") as Label;
if (status == 0)
{
GridView gridSOs = e.Item.FindControl("gridSOs") as GridView;
List<SOResult> subset = ResultsWrapper.Results.FindAll(delegate(SOResult result)
{ return result.Date.ToShortDateString() == date.ToShortDateString(); });
if (subset != null && subset.Count > 0)
{
gridSOs.DataSource = subset;
gridSOs.DataBind();
}
else
{
lblDayResultStats.Text = "No Results Found";
}
}
else if (status == 1)
{
GridView gridDispositions = e.Item.FindControl("gridDispositions") as GridView;
List<Disposition> subset = ResultsWrapper.Dispositions.FindAll(delegate(Disposition d)
{ return d.CommentTime.ToShortDateString() == date.ToShortDateString(); });
if (subset != null && subset.Count > 0)
{
gridDispositions.DataSource = subset;
gridDispositions.DataBind();
}
else
{
lblDayResultStats.Text = "No Results Found";
}
}
if (ResultsWrapper.Dates.Count == 1)
{
Panel p = e.Item.FindControl("pnlDisplayGrid") as Panel;
p.Visible = true;
}
}
protected void rptDays_OnItemCommand(Object sender, RepeaterCommandEventArgs e)
{
if (e.CommandName == "ShowGrid")
{
int index = Convert.ToInt32(e.CommandArgument);
Panel p = (Panel)rptDays.Controls[index].FindControl("pnlDisplayGrid");
if (p.Visible)
p.Visible = false;
else
p.Visible = true;
}
}
html
<asp:Repeater ID="rptDays" runat="server" OnItemDataBound="rptDays_ItemDataBound"
OnItemCommand="rptDays_OnItemCommand">
<ItemTemplate>
<table style="width: 100%; text-align: center; font-weight: bold;">
<tr>
<td style="text-align: left;">
<asp:LinkButton ID="btnDateHeader" runat="server" CommandName="ShowGrid" CommandArgument='<%# Container.ItemIndex %>' /><br />
<asp:Label ID="lblDayResultStats" runat="server" SkinID="lblDetail" /><hr />
</td>
</tr>
<tr>
<td style="text-align: center;">
<asp:Panel ID="pnlDisplayGrid" runat="server" Visible="false">
<asp:GridView ID="gridSOs" runat="server" OnRowDataBound="gridSOs_RowDataBound" DataKeyNames="ScoresID,Portal"
OnRowUpdating="gridSOs_RowUpdating">
<Columns>
<asp:BoundField DataField="Date" HeaderText="Time" />
<asp:BoundField DataField="Portal" HeaderText="Division" />
<asp:TemplateField HeaderText="Interaction" ItemStyle-Font-Size="Small">
<ItemTemplate>
<asp:LinkButton ID="btnInter" runat="server" CommandName="Update" Text='<%# Eval("InteractionID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="FormID" HeaderText="Form" />
<asp:BoundField DataField="Evaluated" HeaderText="Title" />
<asp:BoundField DataField="StatusName" HeaderText="Status" />
<asp:BoundField DataField="FormatedScore" HeaderText="Score" />
</Columns>
</asp:GridView>
<asp:GridView ID="gridDispositions" runat="server" OnRowDataBound="gridDispositions_RowDataBound"
DataKeyNames="InteractionID,Ntlogin,QANtlogin" OnRowUpdating="gridDispositions_RowUpdating">
<Columns>
<asp:BoundField DataField="" HeaderText="Time" />
<asp:BoundField DataField="" HeaderText="Portal" />
<asp:TemplateField HeaderText="Interaction" ItemStyle-Font-Size="Small">
<ItemTemplate>
<asp:LinkButton ID="btnInter" runat="server" CommandName="Update" Text='<%# Eval("InteractionID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="" HeaderText="Evaluator" />
<asp:BoundField DataField="" HeaderText="Title" />
<asp:BoundField DataField="" HeaderText="Disposition" />
<asp:BoundField DataField="" HeaderText="Duration" />
</Columns>
</asp:GridView>
<asp:Repeater ID="rptDispositions" runat="server">
<ItemTemplate>
<table>
<tr>
<td>
<asp:Label ID="lblDispositionName" runat="server" Text='<%# Eval("CommentID") %>'></asp:Label></td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
<hr />
</asp:Panel>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
Patrick McNamara, BS-IS/CS, MBA, MAED
ASP.NET Web Application Developer
Asteryx, LLC.
http://asteryx.com
pat@asteryx.com