Re: CSS and the Data grid control....

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Kevin Spencer (kevin_at_takempis.com)
Date: 03/26/04


Date: Fri, 26 Mar 2004 10:37:21 -0500

See http://www.csszengarden.com

-- 
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Scott" <noemail@this-is-extra-hotmail.com> wrote in message
news:#WhEUU0EEHA.1368@TK2MSFTNGP11.phx.gbl...
>
>  Then how do you style normal items vs. alternating items? If you don't
provide styles on the
> control for normal vs. alternating items they both come out as normal
<tr>... I believe the same is
> true of the selected items in the DataGrid. You can do a lot with a single
CSS but if you want the
> kind of styling that the control has built-in you have to "classify" the
tags of the underling
> table.
>
>  Though, if you have some way to do this in a single CSS class, I love to
see it.
>
> Scott
>
>
> "Kevin Spencer" <kevin@takempis.com> wrote in message
news:utHUVA0EEHA.3784@TK2MSFTNGP10.phx.gbl...
> > >  You can't really change the display of the DataGrid without some
> > programming (especially if you've
> > > done any styling of the control) and achieve the same results using
CSS
> > tags vs. styling it
> > > yourself.
> >
> > I'm afraid I have to take issue with this statement. It is certainly
> > possible to assign a single CSS Class to a Data Grid, and define
completely
> > the styles that each HTML element in the DataGrid should have.
> >
> > -- 
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> >
> > "Scott" <noemail@this-is-extra-hotmail.com> wrote in message
> > news:usoZb7zEEHA.3256@TK2MSFTNGP09.phx.gbl...
> > >
> > >  You can't really change the display of the DataGrid without some
> > programming (especially if you've
> > > done any styling of the control) and achieve the same results using
CSS
> > tags vs. styling it
> > > yourself.
> > >
> > >  What we do is to create our own derived class from DataGrid and
override
> > the the OnItemCreated
> > > method to attach a css classes to the various bits of the DataGrid (if
you
> > really want to do a
> > > strict job of this, then you have to "remove" any programmer styling).
> > It's not perfect but it works
> > > most of  the time.
> > >
> > >  In OnItemCreated, assuming that you've already assigned a css class
to
> > the DataGrid using the
> > > CssClass property; we do something like the following:
> > >
> > >  OnItemCreated(object sender, DataGridEventArgs e)
> > >     ListItemType t = e.Item.ItemType;
> > >     DataGridItem r = e.Item.Controls[0].Parent as DataGridItem;
> > >
> > >     if (t == ListItem.Item)
> > >         r.CssClass = this.CssClass + "Itm";
> > >    else if (t == ListItem.AlternatingItm)
> > >         r.CssClass = this.CssClass + "AltItm";
> > >     // do the same for the rest of the types
> > >
> > >
> > > In your Css file you could have something like
> > >
> > > .DataGrid {
> > > }
> > >
> > > .DataGridItm {
> > > }
> > >
> > > .DataGridAltItm {
> > > }
> > >
> > > "Ram" <RamKulkari@hotmail.com> wrote in message
> > news:eG%23caGwEEHA.1032@TK2MSFTNGP09.phx.gbl...
> > > > Is it possible to control the appearence of data grid control using
> > external
> > > > style sheets ?
> > > > If so, what should be the syntax ?
> > > > Thanks,
> > > > Ram
> > > >
> > > >
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Re: CSS and the Data grid control....
    ... > done any styling of the control) and achieve the same results using CSS ... the styles that each HTML element in the DataGrid should have. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: CSS and the Data grid control....
    ... done any styling of the control) and achieve the same results using CSS tags vs. styling it ... What we do is to create our own derived class from DataGrid and override the the OnItemCreated ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: CSS and the Data grid control....
    ... control for normal vs. alternating items they both come out as normal... ... true of the selected items in the DataGrid. ... Though, if you have some way to do this in a single CSS class, I love to see it. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Free HDMI Cable Anyone?
    ... The point of Cascading Style Sheets (CSS) is to divorce content from ... With legacy HTML, the styling was part of the content, so that you'd ... Another aspect is accessibility. ... this is a technique that was used mostly before browser CSS ...
    (uk.tech.digital-tv)
  • Re: missing borders and background colours
    ... Thanks for the link to the developer toolbar... ... that's how CSS works... ... it was easy to completely change the styling by changing the user ... > different browser rendering behaviours which can get impossibly complex. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)