473,486 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Datagrid ItemDatabound event ??

Dear all,

What is the way to check the value of a particular item in a particular cell
and then set its forground property in red in case of a certain value ??

I have done the following but do dot work :

============================
Select Case e.Item.ItemType
Case ListItemType.Item

If IsNumeric(e.Item.Cells(e.Item.ItemIndex).Text) Then
If CInt(e.Item.Cells(e.Item.ItemIndex).Text) = 945370550
Then
e.Item.BackColor = Color.Red
e.Item.ForeColor = Color.White

End If
End If
End Select

what dis I miss ?

thnaks for your help
regards
serge
Nov 21 '05 #1
2 1432
Serge,

Your first step should be to remove your check for is numeric and that the
text is equal to 945370550 to see if every cell is then colored. That will
let you know if the problem is that the cell isn't being colored or if one
of your checks is not written correctly.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:E9**********************************@microsof t.com...
Dear all,

What is the way to check the value of a particular item in a particular
cell
and then set its forground property in red in case of a certain value ??

I have done the following but do dot work :

============================
Select Case e.Item.ItemType
Case ListItemType.Item

If IsNumeric(e.Item.Cells(e.Item.ItemIndex).Text) Then
If CInt(e.Item.Cells(e.Item.ItemIndex).Text) =
945370550
Then
e.Item.BackColor = Color.Red
e.Item.ForeColor = Color.White

End If
End If
End Select

what dis I miss ?

thnaks for your help
regards
serge

Nov 21 '05 #2
e.Item.ItemIndex is the index of the item in the datagrid's Items
collection. It has nothing to do with Cells collection. To get to a cell,
you need to specify it's column number, 0-based. For example,
e.Item.Cells(3) points to the 4th cell in the row.

Eliyahu

"serge calderara" <se************@discussions.microsoft.com> wrote in
message news:E9**********************************@microsof t.com...
Dear all,

What is the way to check the value of a particular item in a particular
cell
and then set its forground property in red in case of a certain value ??

I have done the following but do dot work :

============================
Select Case e.Item.ItemType
Case ListItemType.Item

If IsNumeric(e.Item.Cells(e.Item.ItemIndex).Text) Then
If CInt(e.Item.Cells(e.Item.ItemIndex).Text) =
945370550
Then
e.Item.BackColor = Color.Red
e.Item.ForeColor = Color.White

End If
End If
End Select

what dis I miss ?

thnaks for your help
regards
serge

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
7882
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
6
3845
by: Jon | last post by:
Hello, I have a datagrid and the data in it is dynamically created at runtime... For iCounter = 0 To dataset.Tables(0).Columns.Count - 1 Dim objbc As New BoundColumn() With objbc .DataField...
2
16974
by: Dominic | last post by:
Hi guys, I'm not sure if this question belongs to FAQ, but I couldn't find a concrete answer. I created a Datagrid control using ItemTemplate, but it's NOT a in-place editing datagrid. One of...
3
4885
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls...
7
1981
by: Scott Schluer | last post by:
Hi All, I have a functioning datagrid on "Page 1" that displays order information for a single order (this is for an e-commerce site). It's actually a combination of a couple datagrids to...
1
3130
by: Mikkel Olsen | last post by:
Hi. I have a problem regarding to the DataGrid_ItemDataBound event. I cant run this event when my datagrid is inside a DataList. The ItemDataBound for DataList1 is working well, but it never...
2
3169
by: Daniel Walzenbach | last post by:
Hi, I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to...
5
5114
by: Paul | last post by:
Hi I need to change the text value of a dropdown list box that is in a template column of a data grid but was not sure how to access it, probably something like datagrid1.control.dropdownlist.text...
1
2535
by: needin4mation | last post by:
Hi, I have a datalist. In this datalist I have a datagrid. The datalist is the master. The datagrid is the detail. It works fine. I populate the datagrid inside of the datalist using the...
8
1244
by: brock wade | last post by:
I have a Datagrid that is working fine displying my records, but I'm trying to program buttons on each record line to launch another web page that shows all the details for the product: ...
0
7100
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7175
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...
1
6842
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
7330
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...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.