Monday, April 6, 2015

"And the beat goes on. And the beat goes on."

Yes Ma, I'm still here tinkerin with M2k.

One of the major tasks we are undertaking in developing the next release is to go through all the web pages that have grids on them and do a proper house cleaning.  Its like when you buy new appliances for the kitchen, you're gonna want scrub a little bit behind where the fridge and stove have been settled for the last decade or two. And you are probably going to find things that you wish you hadn't.  But a thorough cleaning every 10 or 20 years brings you closer to God.

So I have been becoming one with the Microsoft GridView component. To begin with I thought it was simple and a bit clumsy with the whole Templated Column approach for links and whatnot.  And there are times when the object model gets annoying as you try to get after some behavior programmatically.  But I have found it to be remarkably pliable.

One of the astonishing things I found was the ability to databind in the aspx file to a group of children of the current row.  Manage 2000 has always used strongly typed datasets in order to get nice design time support in Visual Studio.  But this also means that strongly typed datarows know how to get their children.

The unfortunate part is some rather scary looking casting in order to access the strongly typed datasets properties and methods.  And also the ever annoying IsxxxNull checks that are a must for optional fields.

But the amazing part is adding a templated column in the aspx and having a child set of sub-values or sub-sub-values unfurl before the user:


So the Planned Components are being bound directly in the aspx file from databinding references:

DataSource="<%# DirectCast(DirectCast(Container.DataItem, System.Data.DataRowView).Row, ROISystems.Components.dstItemOrderListing.MFGORDERRES_Order_DetailRow).GetMFGORDERRES_Order_ComponentsRows %>"