Solved

Gridview  - header

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

10 Experts available now in Live!

Get 1:1 Help Now