I'm using the so-called "Helper Function" for this and it works fine.
I was trying to embed the function logic in the designer page and it was causing me problems.
I really display the ItemDataBound event stuff. Far too tedious to cast into DbDatarecords and the like and I have to make each column it's own control in the designer. The "Helpers" make this really simple.
//In the CodeBehind page...
protected string FormatColorRow(string theData)
{
switch (theData)
{
case "F":
return "style='Font-weight:bold'";
case "I":
return "style='BACKGROUND-COLOR:Gainsboro'";
default: // case "M":
return null;
}
}// In the designer page
<asp:Repeater ID="PerformanceRepeater" Runat="server" EnableViewState="False">
<ItemTemplate>
<tr <%# FormatColorRow((((DbDataRecord)Container.DataItem)["EntityTyp"]).ToString()) %<td nowrap width="20%">
<%# ((DbDataRecord)Container.DataItem)["EntityNme"] %>'>
</td
you inspiring me.
in Code Behind. VBpublic function SetBgColor (byval thedate as string) as string
select case
case "F"
return "blue"
end select
end functionin aspx
<asp:repeater bla..bla...>
<itemtemplate>
<tr bgcolor=<%# SetBgColor(Container.DataItem("EntityTyp").ToString)%>
</tr>
</itemtemplate>
</asp:repeater>
this work for me
tengkiu
FYI:http://aspalliance.com/31
Colt
No comments:
Post a Comment