Solved

Gridview  - header

Posted on 2011-02-23
4
446 Views
Last Modified: 2012-05-11
How can I loop through Gridview header, if find "*", hightlight the header to yellow?
0
Comment
Question by:VBdotnet2005
  • 2
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
gamarrojgq earned 250 total points
ID: 34965337
Hi,

You can do it like this
Dim intCells As Int16
        For intCells = 0 To GridView1.HeaderRow.Cells.Count - 1
            If GridView1.HeaderRow.Cells(intCells).Text.IndexOf("*") > -1 Then
                GridView1.HeaderRow.Cells(intCells).BackColor = Drawing.Color.Yellow
            End If
        Next

Open in new window

0
 

Author Comment

by:VBdotnet2005
ID: 34965571
I got an error : cells  >>> cannot be used like a method

Int16 intCells = default(Int16);
for (intCells = 0; intCells <= GridView1.HeaderRow.Cells.Count - 1; intCells++) {
      if (GridView1.HeaderRow.Cells(intCells).Text.IndexOf("*") > -1) {   <<<<<<<<<<<<<<<<<<<<<<<<<this line>>>>>>>>>>>>>
            GridView1.HeaderRow.Cells(intCells).BackColor = System.Drawing.Color.Yellow;
      }
}
0
 

Author Comment

by:VBdotnet2005
ID: 34965596
My bad....syntex error   [] instead of () GridView1.HeaderRow.Cells

if (GridView1.HeaderRow.Cells[intCells].Text.IndexOf("*") > -1) {
0
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 34965609
ok, sorry I think you were using vb instead of c#, but good to know that you figure it out !!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now