Navigate DataSet

Hi all,

I had a datagridview which is bind to a dataset.

I want to do some condition checking where by if certain field is empty, I will highlight the row of datagridview to some other colour.

By doing this, am I right to say that I need to navigate through the dataset to check if the field is empty.

If yes, may I know how to navigate the dataset? Please help. Thanks

[406 byte] By [bslim] at [2007-12-19]
# 1

Is this ASP.NET application or Windows Forms application? ASP.NET's GridView supports RowDataBound event.

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound(VS.80).aspx

YogeshPrabhu at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...
# 2

Hi,

I am referring to Windows Forms Application. Is there any other ways of retrieving it? Thanks

bslim at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...
# 3

Here's a snippet that you can use for Windows Forms GridView:

DataGridViewRow row;

for (int index = 0; index < myGridView.Rows.Count; index++)

{

row = myGridView.Rows[index];

if (row.Cells[0].Value.ToString() != string.Empty)

row.DefaultCellStyle.BackColor = Color.LightBlue;

}

You would typically run such code after loading/binding your gridview.

YogeshPrabhu at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...
# 4

Hi Yogesh,

Thanks. I manage to get it.

bslim at 2007-9-9 > top of Msdn Tech,Visual C#,Visual C# General...