I need to format each "row" of my datalist based on a certain
criteria. I'm not sure if it's the fact that the items of the
datalist are within a table that I'm having problems getting the
formatting to work or if it's the syntax that I'm using:
Here's the aspx:
<TD vAlign="top" width="70%" height="115"><asp:datalist
id="dlstActivity" runat="server" Width="752px">
<HeaderTemplate>
<TABLE
height="25" width="100%">
<TR>
<TD align="left" width="70%">
<asp:label id="lblActivityName" runat="server"
text="Activity Name" CssClass="textbold">Activity
Name</asp:label></TD>
<TD align="left" width="15%">
<asp:label id="lblActivityHours" runat="server"
text="Activity Hours" CssClass="textbold">Activity
Hours</asp:label></TD>
<TD align="right" width="15%">
<asp:label id="lblAssignedHours" runat="server"
text="Assigned Hours" CssClass="textbold">Assigned
Hours</asp:label></TD>
</TR>
</TABLE>
</HeaderTemplate>
<ItemStyle
HorizontalAlign="Left" Width="450px"></ItemStyle>
<ItemTemplate>
<TABLE
height="25" width="100%">
<TR>
<TD align="left" width="70%">
<asp:label id=lblActivityName2 runat="server"
text='<%# Databinder.Eval(Container,"DataItem.ActivityName") %>'
CssClass="text">
</asp:label></TD>
<TD align="left" width="15%">
<asp:label id=lblActivityHours2 runat="server"
text='<%# Databinder.Eval(Container,"DataItem.SuppAct_hours") %>'
CssClass="text">
</asp:label></TD></TD>
<TD align="right" width="15%">
<asp:label
id=lblAssignedHours2 runat="server" text='<%# Databinder.Eval
(Container,"DataItem.tot_pa_hours") %>' CssClass="text">
</asp:label></TD>
</TD>
</tr>
</TABLE>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left"
Width="450px"></HeaderStyle>
>From the code-behind page - I want to apply the logic that if
the "lblAssignedhrs" value is greater than the "lblActivityhrs" then
I want the text to be red. the below code is producing no change in
the text.
Try
Dim dt_PeopleActivity =
DataHelper.GetPeopleActivitiesAndHours(busID, locID)
Dim dvw_PeopleActivity = New DataView(dt_PeopleActivity)
Dim r As DataRowView
For Each r In dvw_PeopleActivity
If r("tot_pa_hours") > r("suppact_hours") Then
dlstActivity.ItemStyle.ForeColor = forecolor.red
End If
Next
BindActivityDlst(dvw_PeopleActivity)
Catch ex As Exception
Throw New Exception("Get People Activity List failed",
ex)
End Try
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/