GridView - how to fancy it up?

K

Keith G Hicks

Out of the box, the asp.net 2.0 GridView is very plain. Even the AutoFormats
for it are pretty basic. That is compared to what you can get with a 3rd
party tool like Developer Express or Telerik. I'm new to so much of this and
wondering if it's possible using skins/css, etc. (not sure what to ask
exactly) to make the native grid a lot fancier. I know I can change various
colors, borders, etc. using style settings but can I for example put images
in the grid's column headers? Can anyone point me to information explaining
how to make the grid a lot more attractive?

Thanks,

Keith
 
C

Cowboy \(Gregory A. Beamer\)

CSS is your best bet on spicing it up and what the AutoFormats use. If you
want even more spice, you will either have to "subclass" the GridView (make
your own) and add more umph, or go to a third party control.

I cannot envision much, in the way of looks, that CSS cannot handle.
 
K

Keith G Hicks

With css could you for example make the headers "glass" or "metalic" and
include a custom glyph to show sort direction? I konw for that you need
image files but I am so new to this I don't know where to begin. I'd like to
try but I need some direction. Does anyone know of any samples I could look
at in order to get a better understanding of this? My impression so far is
that even with css, if the control doesn't have a property (such as
HeaderImageURL) then it cannot be done anyway. I'm sure I'm wrong, but
that's what my limited knowledge of this tells me. When you say that css is
what the AutoFormats use, I see that with something like Developer Express'
grid but when I apply an AutoFormat like "Colorful" to the native grid, I
don't see any new css files anywhere in my site's files.
 
C

Cowboy \(Gregory A. Beamer\)

Many of the things you see in other grids are simply CSS linked to images.
Quick example:

<HeaderStyle CssClass="Glass" />

And here is the style:

Glass {
background:url(images/glass.png) repeat;
}

I did the CSS on the fly, so I may have an issue with syntax, but it does
follow the basic idea.

Play with CSS and get the look you desire, then add that class to your
header.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top