I've got a list of people coming in from a stored procedure alphabetically, stored in a dataset, bound to a custom datasource, then displayed in the order that they came in
on.
protected void gvPhotoGrid_OnItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem | e.Item.ItemType == ListItemType.Item)
{
Label l = (Label)e.Item.FindControl("lblTitle");
if (l != null)
{
string strval = l.Text;
string title = _title;
if (title == strval)
{
l.Text = "";
e.Item.Visible = false;
}
else
{
title = strval;
_title = title;
l.Text = "<br/>" + title;
e.Item.Visible = true;
}
}
}
}
My problem is, two people got a divorce and can't be next to each other. They both have the same last name so by default they would come in to the list right next to each other. So, what would be the logic to display one of the people on the list in a different location without putting them at the bottom or top?
<asp:DataList ID="gvPhotoGrid" runat="server">
<ItemTemplate>
<tr id='<%# Eval("DiaLevelName") %>' align="center">
<td colspan="2"><asp:Label ID="lblTitle" Font-Underline="true" Font-Bold="true" runat="server" Text='<%# Bind("DiaLevelName") %>' Visible="true" >
</asp:Label> <td><a href='<%# ResolveUrl("gemProfile.aspx?gemid=" + Eval("userID") + "&Name=" + Eval("calendarSearch")) %>'>
<asp:Image BorderWidth="0px" ID="Image1" runat="server" AlternateText='<%# Eval("userName") %>'
ImageUrl='<%# ResolveUrl("~/images/gemImages/" + Eval("gemImage")) %>' />
<asp:Label runat="server" ID="lblName" Text='<%# Eval("userName") %>' />
</ItemTemplate>
</asp:DataList>