2

Resolved

CSS for GridView is broke

description

Someone has modified the GridView so that one can no longer assign custom style classes to table rows. For instance, previously the declarative statements worked:

file attachments

comments

mark4asp wrote Jun 20, 2008 at 1:26 PM

This forum software is a bit dubious. It posted my item before it was ready. I meant to include examples of styling declarative statements which used to work. Here they are:
<HeaderStyle CssClass="gvTitle" />
<RowStyle CssClass="gvRow" />
<AlternatingRowStyle CssClass="gvRow bg-varigated-light" />
The last two <RowStyle /> and <AlternatingRowStyle /> no longer work. When I say "used to work" I mean worked with the previous version of the CSS-Friendly controls but not with the version I downloaded recently.

mark4asp wrote Jun 20, 2008 at 2:41 PM

I've got things wrong here - getting confused with an earlier version which was somehow in my bin folder.

However, ask yourself the question - how am I getting confused between these versions? Do they have version numbers? (or maybe it's just my custom compiled dll which is lacking a version number?, but they all say version 1.0.0.0

I just downloaded your dll too - it has version 1.0.0.0. The comment says "beta 3" and but you need to version this thing with a number as well as a comment. How am I supposed to KNOW that I must look in the comments to find the version?

TehOne wrote Jun 20, 2008 at 10:58 PM

I'm not sure you do have this wrong. I just downloaded "Change Set 11160" and it doesn't apply my AlternatingRowStyle CssClass. I opened up GridViewAdapter.cs and changed this:

case DataControlRowState.Alternate:
                        className = " AspNet-GridView-Alternate ";
                        break;
to this:

case DataControlRowState.Alternate:
                        className = " AspNet-GridView-Alternate ";
                        if (gridView.AlternatingRowStyle != null)
                        {
                            className += gridView.AlternatingRowStyle.CssClass;
                        }
                        break;
And now I get my alternating row style css class applied.

I'm sure this may also need to be done for the other (header, row, footer, etc) styles as well, but I didn't make these changes and didn't test it.

wrote Jun 20, 2008 at 10:58 PM

wrote Jun 20, 2008 at 11:24 PM

TehOne wrote Jun 20, 2008 at 11:24 PM

Ok, I have edited in all the other styles now as well, the file is attached.

wrote Jun 20, 2008 at 11:24 PM

TehOne wrote Jun 20, 2008 at 11:31 PM

Fixed a small bug in the last uploaded file where the cssclass would get put on more then once for the pager rows.

wrote Jun 20, 2008 at 11:31 PM

bdemarzo wrote Jul 30, 2008 at 5:42 PM

I think, by practice, the "Style" properties were ignored. However, I can see the merit in adding support for the CssClass style properties, so I'll add it since it's relatively easy to do.

Patch coming today.

wrote Jul 30, 2008 at 5:42 PM

wrote Jul 30, 2008 at 5:49 PM

Fixed on changeset 15615

wrote Jul 30, 2008 at 5:49 PM

wrote Feb 14, 2013 at 8:44 PM

wrote May 16, 2013 at 10:19 AM

wrote May 16, 2013 at 10:19 AM

wrote Jun 14, 2013 at 7:20 AM