Solved

Gridview  - header

Posted on 2011-02-23
4
447 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

786 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