Datagrid and boolean field dispalay

A

Annie

Hello guys,

I have a template column that is bound to a database field with True and
False value. So it displays True or False as per item.

The code is as:
<tr>
<td align="left"><b>Colour Screen</b></td>
<td><%# DataBinder.Eval(Container.DataItem, "ModelColour") %></td>
</tr>

However, i don't want to show True or False maybe display it as Yes or No or
anything customized.
How can i do it with above code?

TIA
 
T

Tasos Vogiatzoglou

An easy way :

<td class="boolean<%# DataBinder.Eval(Container.DataItem,
"ModelColour") %>"></td>

with appropriate css classes for .booleanTrue and .booleanFalse. This
is good in case you want to display an image.

and a hard way:
If you want to display a custom message you will have to listen for
ItemDataBound event of your control.

Tasos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top