thanks David, i tried that kinda method and had issues converting generic list to collection array.
Maybe i need to explain my self better...sry,
there is default.aspx page that uses a masterPage. In the default.aspx.cs there is:
Code:
List<HealthGoal> goals = null;
goals = SiteProvider.Member.GetGoalsForMember(Convert.ToInt32(Session["PersonID"]));
..... create an xml string of the values to pass to the default.aspx via Page.ClientScript...blah blah
.....
now the goals[i].GoalTypeID (numeric) is what i want the unique list of.
In the master page.aspx i have:
Code:
<asp:DataList ID="dlResults" runat="server" OnItemDataBound="dlResultsDataBound" Width="150">
<ItemTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" valign="top"><img alt="" src="/images/members-area/subnav-bullets/green.gif" width="28" height="20"></td>
<td valign="top">
<asp:HyperLink CssClass="subnav" ID="HyperLink1" runat="server"><%# Container.DataItem %></asp:HyperLink>
<asp:Label ID="Label1" runat="server" Text='<%# Container.DataItem %>' Visible="false"></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
and the behind code is the where the code were are talking about should go. So now that you have the whole picture, any ideas how to DataBind the unique list of goals[i].GoalTypeID
I'm trying to incorporate your diction idea, as i think your thought has much validity, this is what i'm starting with:
Code:
protected void dlGoalsDataBound(object sender, DataListItemEventArgs e)
{
ArrayList DataListItemEventArg = new ArrayList();
DataListItemEventArg = SiteProvider.Member.GetGoalsForMember(Convert.ToInt32(Session["PersonID"]));
SortedDictionary<string, DataListItemEventArg> Goals = new SortedDictionary<string, DataListItemEventArg>();
for (int i = 0; i < e.Length; i++)
{
try
{
Goals.Add((DataListItemEventArg)e[i].Goal, e[i]);
}
catch
{
//
}
}
dlGoals.DataSource = Goals;
dlGoals.DataBind();
}