By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,217 Members | 1,458 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,217 IT Pros & Developers. It's quick & easy.

Display bitmap in datagrid column ???

P: n/a
Dear all

I have a datagrid which is bind to a dataset
On column in the dataset represent a STATUS
Instead of diplaying in my datagrid value of 1 and 0 corresponding to that
STATUS field, I would like to display a Green bitmap for a value of 1 and a
Red bitmap for a value of 0

how can I do that ??

thnaks for your help
regards
serge
Jan 20 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
If I understand your question, you could create a Template Column rather than
a Bound Column, as shown below:

<asp:TemplateColumn>
<ItemTemplate>
<asp:label id="Label1" runat="server" Text='<%# "<img src=" &
iif(DataBinder.Eval(Container, "DataItem.Status")=1,"green.bmp","red.bmp") &
">" %>'></asp:Label></ItemTemplate>
</asp:TemplateColumn>

Hope this helps.

--
-Chad Grooms, MCSD
www.chadgrooms.com
"serge calderara" wrote:
Dear all

I have a datagrid which is bind to a dataset
On column in the dataset represent a STATUS
Instead of diplaying in my datagrid value of 1 and 0 corresponding to that
STATUS field, I would like to display a Green bitmap for a value of 1 and a
Red bitmap for a value of 0

how can I do that ??

thnaks for your help
regards
serge

Jan 20 '06 #2

P: n/a
hi chad

I have tried your suggestion and I get an error saying "Expression expected "

Any idea?

"Chad Grooms, MCSD" wrote:
If I understand your question, you could create a Template Column rather than
a Bound Column, as shown below:

<asp:TemplateColumn>
<ItemTemplate>
<asp:label id="Label1" runat="server" Text='<%# "<img src=" &
iif(DataBinder.Eval(Container, "DataItem.Status")=1,"green.bmp","red.bmp") &
">" %>'></asp:Label></ItemTemplate>
</asp:TemplateColumn>

Hope this helps.

--
-Chad Grooms, MCSD
www.chadgrooms.com
"serge calderara" wrote:
Dear all

I have a datagrid which is bind to a dataset
On column in the dataset represent a STATUS
Instead of diplaying in my datagrid value of 1 and 0 corresponding to that
STATUS field, I would like to display a Green bitmap for a value of 1 and a
Red bitmap for a value of 0

how can I do that ??

thnaks for your help
regards
serge

Jan 23 '06 #3

P: n/a
Sorry, you need to add the line continuations...

<asp:TemplateColumn>
<ItemTemplate>
<asp:label id="Label1" runat="server" Text='<%# "<img src=" & _
iif(DataBinder.Eval(Container, "DataItem.Status")=1,"green.bmp","red.bmp") & _
">" %>'></asp:Label></ItemTemplate>
</asp:TemplateColumn>
--
-Chad Grooms, MCSD
www.chadgrooms.com
"serge calderara" wrote:
hi chad

I have tried your suggestion and I get an error saying "Expression expected "

Any idea?

"Chad Grooms, MCSD" wrote:
If I understand your question, you could create a Template Column rather than
a Bound Column, as shown below:

<asp:TemplateColumn>
<ItemTemplate>
<asp:label id="Label1" runat="server" Text='<%# "<img src=" &
iif(DataBinder.Eval(Container, "DataItem.Status")=1,"green.bmp","red.bmp") &
">" %>'></asp:Label></ItemTemplate>
</asp:TemplateColumn>

Hope this helps.

--
-Chad Grooms, MCSD
www.chadgrooms.com
"serge calderara" wrote:
Dear all

I have a datagrid which is bind to a dataset
On column in the dataset represent a STATUS
Instead of diplaying in my datagrid value of 1 and 0 corresponding to that
STATUS field, I would like to display a Green bitmap for a value of 1 and a
Red bitmap for a value of 0

how can I do that ??

thnaks for your help
regards
serge

Jan 23 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.