Saturday, January 17, 2009

Applying Styles on EditCommandColumn buttons

Every button looked good. I mean, according to the project standards. Every button had that blue gradient background, with bold text. Every button looked good. Except that of the datagrid's EditCommandColumns and ButtonColumns.

Mmmhh... intelligent me, I immediately got down to work and applied the stylesheet property (CssClass, that is) to each buttons on ItemDataBound event of the datagrid.

Neh, it wouldn't budge.

Ha! It could be ItemCreated.... yeah, that is it. ItemCreated. How foolish I could be? Did I forget all those days when I had these memorized in my smart brain?

Select. Copy. Paste.

ItemDataBound event handler replaced with ItemCreated event handler. It should work this time. It should!

What? It doesn't? Why? The code says to apply the stylesheet every time the row is being created. Why not?

Mmmhhh... what should be the next step?

Google!

I was right, even the most reputed forums support that I was right!

What might have happened?

I had to find out. Right-Click. View Source.

Mmmhh.... see... every button in the EditCommandColumn and ButtonColumn had the "class=" already applied... for Edit button, it was "Button_Edit", for update button, it was "Button_Update"... and so on...

And it wouldn't change even if I insist.

Open Style.css. Create a new class for Button_Edit, Button_Update... and so on.

Eureka!!

That gradient blue background.... in my EditCommandColumn buttons too...

Thursday, January 01, 2009

Another New Year

Another New Year!

2008 was not a good one for me as a blogger. That's because I have not been blogging a lot lately. Have been very busy selling my old house, buying a new one, recovering from a lyme-disease attack, and settling in the new house.

Even if you (and I) don't see any comments on my blog entries, I have lot of fans (:)), known as readers :) And they complain a lot (through emails and phone) when they dont see any blog entries. And that happened a lot in 2008.

This year (its already 2009, can't believe it) is going to be a special one. A very special one. In many ways. And one of them would be blogging. Blogging about .NET and other things.


So, a very happy new year for all my readers! Come, visit this blog often. As I said, 2009 is going to be very special!