473,394 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Display bitmap in datagrid column ???

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
3 1659
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DraguVaso | last post by:
Hi, In the override of the Paint-method of a DataGridTextBoxColumn I want to show an image with BitBlt, to see what I can gain there on performance. The problem is: It doesn't show me the image...
1
by: james autry | last post by:
Is there an example somewhere of how to insert a Bitmap column into a DataGrid?
4
by: Bill Todd | last post by:
Is there any way to display the RowState of each row in a computed column in the DataTable? -- Bill
18
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
3
by: Andrew S. Giles | last post by:
Hello, I am importing a flat text file, and putting it into a datagrid for display on a form. Currently the users have their dates and times seperated. I have two fields, therefore in the...
2
by: Olav Tollefsen | last post by:
How can I display photo images stored in a SQL Server 2000 databases in a DataList or DataGrid without having to write the images to files first? Olav
0
by: AdrEsqu | last post by:
Can anybody show me how to display a bitmap impage in a datagrid cell? Code: grid.AddNewRow() GridCell cell = grid.AddNewCell(); cell.Text = ???????????????
0
by: Jeff | last post by:
Help!!! The bitmap I am trying to display in a sample Crystal Report is coming up with much less quality than the original bitmap. I have a 300x300 dpi bitmap file that I want to insert at run...
15
by: Hamed | last post by:
Have I posted the message to wrong newsgroup? Or Does the question is so much strage? Would someone please kindly direct me to a true newsgroup or resource? Best Regards Hamed
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.