Need Asp.Net advice

Need Asp.Net advice

Old forum URL: forums.lhotka.net/forums/t/7749.aspx


ajj3085 posted on Wednesday, October 07, 2009

Hi,

I'm at a loss on how to proceed. My client has a UI which edits many properties on a BO on a single web page. The issue is that most of properties are logically grouped together (these are email settings, email template 1, 2, 3, ... 6) and as a unit validate together.

For example, each template has an Enabled property, and if enabled certain values are required. Otherwise, the validation rules switch to warnings. So in this sense it makes sense to break things into a root / child object, with six child object properties. Indeed, that's what I've done, and I have the root BO class and child class.

Ideally, I'd like to use that setup... but the details of implementing this on one page I'm not figuring out. The Update event on the CslaDataSource would normally work, but there's only one update, and that doesn't fit with the chlid object setup (where it seems they'd have their own CslaDS and update command buttons).

Any suggestions?

DancesWithBamboo replied on Wednesday, October 07, 2009

Could you post a pic of the UI.  I'm not following what the 6 update buttons for the children would look like on a single page.

ajj3085 replied on Thursday, October 08, 2009

In their mockup they don't have six update buttons... but I think I would need them (probably in each section) to make my current design work.

DancesWithBamboo replied on Thursday, October 08, 2009

Are you planning on putting each logical section in their own UpdatePanel and then the "Update" button would just update the values from that panel?  Otherwise the whole page will post back and all the values in all sections will be synched to their BO; defeating the need for multiple buttons. 

I don't think having multiple update buttons on the same screen is a good idea.  On the web at least, the expectation is to have one "Save" button that updates everything on the screen.  If you have logical sections, then maybe a tab control might be better suited and then you can update automatically as the user moves from tab to tab.

ajj3085 replied on Thursday, October 08, 2009

Right... that's my question, how can I keep the cleaner code while still giving them the UI they want?

DancesWithBamboo replied on Thursday, October 08, 2009

I am being ultra-dense this morning; so bear with me.  You want one screen, one update button, and various fields on the screen bound to any of the 6 children of the root object.  When the user clicks "Update", the root and all its children will validate and save.

But you aren't sure how to connect the children up using just the one datasource?

ajj3085 replied on Thursday, October 08, 2009

Yup, that's pretty much it.

Previously the screen had only two emails and it was all contained within one root BO. Now they've added four more, so I thought it would be easier to maintain if the email settings were one class with a fixed number of instances (especially if they add more later).

Basically the more maintainable solution doesn't quite match the use case, and thus the "mismatch" problem. If it can all work with multiple datasources but only one button to cause all the updates to fire, that'd be ideal, but from my limited experience it doesn't seem like that would be possible.

DancesWithBamboo replied on Thursday, October 08, 2009

The simplest solution might be to not use the csladatasource.   Just read and write values to and from you business objects when you need to (Page_Load and "Save")

Copyright (c) Marimer LLC