Hi,
As Nicholas suggested it's better if you can do it in the SP, now in the
case that the meaning of the values are not saved in the DB or just that you
want to display it someway different ; like a different color depending of
the priority ; you can use a code like this:
in the aspx page:
<asp:templatecolumn ItemStyle-VerticalAlign="Top"
ItemStyle-Width="70" ItemStyle-HorizontalAlign="left"
ItemStyle-Cssclass="sidebar2">
<itemtemplate>
<asp:Label CssClass='<%# SelectDaysLeftCssClass(
((Accident)Container.DataItem) ) %>' Runat="server" Text='<%#
((Accident)Container.DataItem).Status %>' ID="Label2">
</asp:Label>
</itemtemplate>
</asp:templatecolumn>
As you can see I use a method to return the correct CssClass of the label
depending of the element being binded.
BTW, I bind the grid to a strong typed collection, but its the same if a
datagrid/datatable is used.
later in the code behind :
protected string SelectDaysLeftCssClass( Accident accident)
{
//If closed get the "blue" one
if ( accident.Status == Accident.AccidentStatus.Closed )
return "textblueReal";
//The record is open, if overdue red, normal otherwise
if ( accident.DaysLeft > -1 )
return "text";
else
return "textred";
}
The same thing you can use to display an interpretation of a value from the
database.
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"spmm_pls" <sp******@yahoo.com> wrote in message
news:f5**************************@posting.google.c om...
Hi,
Could some1 please tell me what the best way is to adjust the value of
a column in my databound datagrid (in ASP.NET)
For example my database returns the values 1,2 and 3 in the column
Priority. But 1,2 and 3 actually represent "Low", "Medium" and "High".
So instead of a column filled with 1,2,3's I want a column filled with
Low,Medium,High's. How do I do that??
Can (should) this be done in my C# code, or do I have to adjust my
stored procedure on which the datagrid is based?
thanks!