Solved

Gridview  - header

Posted on 2011-02-23
4
450 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 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