Last post Nov 19, 2010 09:34 AM by mbowles
Nov 19, 2010 08:54 AM|mbowles|LINK
I have a gridview (that sits above a goup of formview usercontrols on a page) whose datasource returns a list of table names (10 or so, datakeys are id and tablename) and some other values from a table and populates the gridview with a select column and
a few other details.
The formview usercontrol has a property that sets the datasourceid and these are done on the apsx. On select in the gridview, the page posts back and tells the appropriate formview usercontrol, based on a giant switch statement, to databind and turn visible.
In the page_init, all formview usercontrols have their formviews enabledynamicdata for the appropriate table name.
All formviews start in edit mode (per client). The switch will also takes the id from the gridview select and loads a small list of links ot the right of the visible formview that point to other tables with details about the table displayed in the formview.
These links pass a querystring paramater of another table name to a popup that runs a switch on page init, using the table name to dictate the datasource for a single formview (with 10 or so LinqDataSources on the aspx), binds and opens in edit mode. Seting
this on init allows the formview to properly edit, etc.
Here is how a user sees it. Homepage, choose an "area" This takes you to a page that loads a gridview at the top of the page. You click on select int he select column based on a tablename you want to review. This (via ajax) posts back and loads a formview
with summary details and a short list of links to further details. You can edit the data in the formview and/or select a link. Selecting a link launches a popup with a single formview for another table and you can edit it. Repeat...
The page/system runs, and runs well performance wise. To the end user, it is clean, does exactly what he wants....but (you knew one was coming) the architecture of the page(s) just seems like a hack to me (new to linq and dynamic data)
Is there a better approach for this? The database is done and I can not change it. And the only mapping from summary tables to details tables is that I know the names and how they relate. The customer did not want to use the default dynamicdata based
site with list and forms as he had decided how he wanted the pages to look, load etc... I dont like hainvg a giant switch, stacks of LiqDataSource tags, etc..
Nov 19, 2010 09:06 AM|sjnaughton|LINK
Hi Mbowles, I would look at haveing the FoemView in user controls, that would keep the markup clean, but I think you may have to stick to you switch statement.
Dynamic Data 4
Nov 19, 2010 09:34 AM|mbowles|LINK
Yep, put a formview in a usercontrol. Was kinda thinking the switch was the only viable option, but thought I would check.