Link to home
Start Free TrialLog in
Avatar of crescendo
crescendo

asked on

Adding my own style to the built-in datagrid auto-format list

I am updating a website that has a large number of datagrids and I want to change the colours on each one to the new standard. It will be really tedious and time-consuming to edit each datagrid, so is there a way I can add my style to the built-in list, and simply use auto-format on them?
Avatar of a_ro_no
a_ro_no
Flag of Greece image

Avatar of AerosSaga
AerosSaga

Just paste your css in the head of your .aspx file and then set the css class property of the datagrid to the name of your css class.  Easy!!

Regards,

Aeros
Avatar of crescendo

ASKER

Hi both

CSS solutions work fine if the parts of the datagrids (items, headers, footers etc) have consistent CssClass names across the site, but they don't, and I'm trying to avoid editing every datagrid in that much detail to make them consistent.

Any other ideas? Surely there must be a way of modifying the built-in styles?
you can use the property builder in the IDE as well as the stylebuilder.

regards,

Aeros
Aeros

But then I'd have to format them all individually wouldn't I?
if you use css file, you should add
<LINK href="Styles.css" type="text/css" rel="stylesheet">
in the head tag of aspx page.

or you can add
<style>
     .grid{
          font-size:     10pt;
          color: #000086;
          background-color: White;
.....
}    
</style>
in the head tag of aspx page

It is just copy paste... ;)
After that if you want to change the style of your grid the only thing you will have to do is to modify the stylesheet!
Ooops i haven't noticed your post sorry...!
Inheritance is definitelly one way...
Perhups building a custom control that derives from datagrid control... I'll check it.
I know it's more work, but I think it will pay off for you in the long run.

Make a css file that defines your standard styles.
Add the css link tag (as already mentioned) to each page.
Then edit each datagrid and add the new standard classes to the CssClass of each datagrid.
Finally, remove as much extraneous style info as you can from your datagrids.

Make the effort once, and you won't have to worry about it in the future when you need to add datagrids, or change your styles, or whatever.

It's mostly minor routine edits anyway (probably).
a_ro_no

I know the benefits of using a style sheet. The problem is that the datagrids seem to have been formatted by a team of madmen. They use different style names all over the place. I'm trying to cut down on the work involved to get back to a standard.
So in short crescendo without using css, I don't think theres a way to "Globally" format datagrids

Regards,

Aeros
No way of adding my own style to the built-in auto-format list?
ASKER CERTIFIED SOLUTION
Avatar of a_ro_no
a_ro_no
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There wasn't a solution to the question, except an agreement that it can't be done. I'm happy to give the points as a reward for the effort invested, but it's not much use as a PAQ.