Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generic Maintenance Forms
Message
From
11/02/2004 08:38:29
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00876069
Message ID:
00876207
Views:
12
>Steve,
>
>>I would like to be able to set up a "Generic" bizobj that I can use on a "Generic" lookup table maintenance web form. Unless there is a really good reason to, I'd rather set this up generically rather than creating a bizobj/webform for every lookup table - since nearly all of them have the same structure. Actually, I have started attempting to build this, but ran into some problems when changing the table within the UI. I decided it might be better to post the idea to see if this appears to be something that is possible within the framework and if this is a valid approach.
>
>It is conceivable to do something like this. You should be able to instantiate the generic business object, set its properties such as TableName, PrimaryKey, and SELECT statement. What problems were you running into trying to do this?
>
>Regards,

So far, what I've done is created a bizobj that has an override of the constructor that accepts a tablename and thus sets that property. It then queries the SQL Server schema to determine the primary key and sets that property. It has a generic getAll method that constructs the SELECT statement and returns a dataset with all records for the specified table.

I have created a web form (mmBusinessWebPage) with a dropdown list for selecting the table to be maintained and an mmDataGrid with its BindingSource set to the generic bizobj class name (Lookup). The SelectedIndexChanged event handler for the dropdown list gets the selected table name, calls the RegisterBizObj(new Lookup(tableName)), calls the getAll method, sets the mmDataGrid BindingSource & BindingMember properties, and then calls the form's BindControl with the name of the datagrid.

I'm currently having trouble with the datagrid button column event handlers (Edit, Update, Cancel, Delete), so I need to get that resolved before I will know what the issues are with the form handling of the generic bizobj.

Thanks for the response - I mainly needed to know if this was even a worthwhile approach before spending a lot of time with it.
Previous
Reply
Map
View

Click here to load this message in the networking platform