Musings of Geekdom by Eric Newton

tail /var/log/thoughts
posts - 88 , comments - 41 , trackbacks - 68

Long live ASP.NET, (please dont bloat ASP.NET)

I've realized that ASP.Net is getting BLOATED with lots of “RAD” tools, and making it harder and harder to do things “the ASP.NET way”  

I spend hours fighting with DataGrids and GridViews.  Sure they work great out of the box, but sometimes you gotta do things “outside the grid“, and thats when things get whacky... fast. 

For instance, last night I'm building a GridView with a set of strongly typed domain objects (via Wilson ORMapper; fantastic library).  The ObjectDataSource control just cant handle it.  So now I'm already hitting bare metal.  Over to the codebehind and add a couple lines:

GridView1.DataSource = quotedb.ObjectSpaceManager.GetObjectSet<QUOTEDB.SHOPPINGCARTDETAIL>(string.Format(“ShoppingCartID={0}“,shoppingCartId))

Ok, great!  It works! Eureka!  but wait, I gotta pull the Description property from a child property from the ShoppingCartDetail instance, via ShoppingCartDetail.ProductObject.Description.   Bang!  GridView fails again.  I guess you can't say <asp:BoundField DataField="“ProductObject.Description“" />

Ouch, bare metal again... So more codebehind:

GridView1_RowDataBound(...) {
   if(e.Row.RowType == DataControlRowType.Item)
      e.Cells(1).Text = ((quotedb.ShoppingCartDetail)e.Row.DataItem).ProductObject.Description;

Refresh, and viola! Description!  Cool!  ...except its bold?  Hmmm thats bizarre.  “View Source...” and it begins rendering <TH> tags around the Description?  WTF?  So by this time I'm furious.  I've gotta REPLACE TEXT on the output html?!?!  Whats the point of all this?  Why does the GridView fail me everytime I step outside the box?  Yeah, its better than DataGrids... don't get me started!

This is after putting down a DIFFERENT problem on the same page trying to calculate SalesTax and stuff into a cookie for the checkout page. 


Working with SqlDataSources and GridViews is a MAJOR improvement over DataGrids of 1.0 era.  Thank God for that!  Paging, sorting, and nifty client-side callbacks for Paging and Sorting... neat!  But this is directly accessing the database.  So its tied to my database schema very tightly.

Look the reason why I use .Net... Its a great platform over all.  Fantastic.  I cringe anytime I even think about code thats not managed.  C++?  You can have it.  Java... I'll pass.  Good start!  But Sun's is resisting some runtime “updates“, specifically generics.  (I know they'll have them, which is a start, but no perf improvements from the runtime since they just downgrade to object type anyways, with the same casting inefficiencies)

And ASP.Net's WebServices are fantastic.  Decoupling along with good contracts is a fantastic way to be able to manage code/database evolution.

GridView is almost there... leagues ahead of DataGrids, but still needs more “real world” like nested properties and so forth...

Print | posted on Monday, July 25, 2005 10:18 AM |



# re: Long live ASP.NET, (please dont bloat ASP.NET)

This is the single biggest drawback of any web-based grid control I've used. I'm surprised I don't see more complaints about this. My guess is that OR/M tools with their complex hierarchies are more susceptible to this limitation. For my part, I usually end up flattening the data, either on the DBMS or in a wrapper class, prior to binding. This is a shame because it adds needless complexity to the presentation layer.

9/1/2005 8:08 AM | Matthew Vandergrift

# re: Long live ASP.NET, (please dont bloat ASP.NET)

ObjectDataSource drives me nuts, its really no good if you can't databind to nested properties, I prototyped all the .NET controls and added an UnbindToProperty property to specify a property of a given object to unbind to, UnbindingHelper and FormUnbinder class, works quite well and does not restrict me to the funny world of business objects ObjectDataSource is aimed at.
2/1/2006 10:30 AM | Fluxtah

# re: Long live ASP.NET, (please dont bloat ASP.NET)

Agreed, coming from a Java background and using libraries like DisplayTag, the first thing I tried to do after adding a GridView was access a nested property using "DataField="“ProductObject.Description“". A little free Java library can do it but Microsoft can't build it into their Gridview?


I enjoyed your post.
1/11/2008 1:21 PM | Joe

# re: Long live ASP.NET, (please dont bloat ASP.NET)

Try using templated columns.
You can avoid all the reflection stuff that goes on under the hood with the "DataField". They more flexible down the track too.

btw SqlDataSources are the worst thing ever to happen to They discredit anyone using the platform.
11/18/2008 4:43 PM | En
Comments have been closed on this topic.

Powered by: