Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Gridview  - header

Posted on 2011-02-23
4
Medium Priority
?
465 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 1000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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.…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

916 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