Friday 11 May 2007

ASP.NET Web Controls

They're not ready yet!

Its web controls are beginning to cause me problems that I'm not entirely sure how I'm going to find a way around, but I'm going to post it here as soon as I do.

Imagebuttons do not have an onmouseover / onmouseout feature, which seems ridiculous to me, so I wrote a custom control that takes care of it instead. It inherits the linkbutton control with some additional methods. There are plenty of howtos floating around on the internet, so this wasn't a bit problem for me.

The big problem is turning out to be the gridview control.

Sorting out paging and sorting seems like a minimum of fuss, and I'm happy for people that require that really badly, but I'm much more concerned with a lack of formatting.

If you want to add columns to a datagrid in the code-behind, you seem buggered as far as I can see. You can't just do:

objGrid.columns.add("Column1", datasource.column1)

Why the hell can't you do that? It's common sense!

Styling fields is also a problem.

Say that your database produces a column that will contain an integer from 1 to 5. If you get number 1, you want it to say "Gold" in a nice gold font. If you get number 2, you want it to say "Silver" in nice silver font, and so on.

How the hell are you supposed to do this? One suggestion was to customise the control by inheriting the grid's class. Why should I have to do this? Why isn't basic styling for the code-behind included? Is this going to happen in .NET 3.0?

To give you a more accurate picture of what I'm talking about, see the link below:

http://www.dabs.com/productlist.aspx?&CategorySelectedId=11146&NavigationKey=11146&PageMode=1

Scroll down to the product listing, and you can quite clearly see that those rows of what I reckon is a gridview are customised to style differently depending on their values.

Some of this was surely done in the code-behind, as an objectdatasource for every page is a bit silly, especially if you want to use a proper data access layer.

If anybody's got any thoughts on this, feel free to leave a comment and let me know what I'm doing wrong that the gridview supports, as I'm at the end of my tether. How on earth you can see fit to release a control that at best binds with basic styling is ludicrous.

Furthermore, how the hell is this seen as an enterprise solution if you have to inherit classes and write new methods that do what should happen anyway?

Rant over, and I'll post a solution with complete explanation as soon as I can.

No comments: