How to Add Colors to Alternative rows in GridView

We can add colors to alternative rows by doing like this

suppose there exists 10 rows in a grid view 

so

we can do it in c# like this

for (int i = 0; i <= 9; i++) {
	ActGridView.Rows(i).BackColor = System.Drawing.Color.Black;

	i += 1;
}

& in vb.net as

For i As Integer = 0 To 9
	ActGridView.Rows(i).BackColor = System.Drawing.Color.Black

	i += 1
Next
Advertisements

About kakani santosh kumar

Working as Software Engineer in Prithvi Information Solutions having 3 years of Experience in Dotnet Framework ranging from 1.1 to 3.5
This entry was posted in Database, Interview Questions, Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s