MS Datagrid questions..

Posts   
 
    
Posts: 11
Joined: 29-Apr-2005
# Posted on: 29-Apr-2005 01:12:28   

One of the things I commonly do with winforms datagrids is to add another column to the underlying datatable to contain a boolean in order to place a checkbox into the datagrid. The purpose for this is to mark rows for deleting.

Now that Im using LLBLGen Pro, instead of working with datatables as the datasource, Im using the generated collection objects. I dont seem to be able to find a way to add a checkbox column to the datagrid. I tried it through adding an additional columnstyle in the grids tablestyle, but it doesnt show up in the grid when running.

Question is how do I get a utility type column like this into the datagrid when its datasource is a LLBLGen Pro genereated collection object. Or, if that seems like a bad approach in the first place, what do you consider a best practice to allow a user to bulk delete from a datagrid?

Thanks, Jim

Rogelio
User
Posts: 221
Joined: 29-Mar-2005
# Posted on: 29-Apr-2005 02:20:21   

Hi,

Add a new property to your Entities, this new property would be Boolean type.

With the new "User Code Regions" implemented in version 1.2004.2, you can add new properties and them will be keep after the regeneration of code.

Posts: 11
Joined: 29-Apr-2005
# Posted on: 29-Apr-2005 18:56:39   

I realize that is a workable solution, however I just dont think it provides good seperation between the UI layer and the business object layer. There are so many different things in the UI layer that I sometimes modify datatables returned from the business layer. Things would get really messy if I needed to move some of this logic into the business object layer.

Does anyone know of a way to manipulate the objects at runtime to acheive the same thing without adding properties and such to the genereated objects?

Thanks

Answer
User
Posts: 363
Joined: 28-Jun-2004
# Posted on: 30-Apr-2005 04:36:14   

Are you defining the columns manually through the property editor? I know in ASP.NET datagrid i have done this exact same thing and it worked fine. I just defined each column manually, then set the binding name for each column, in the check box case i dont set a binding value.

If that doesn't work, i suppose you could always just create a class in the UI that has a single property of boolean, then inherit your enitity, that way your entity itself doesn't have UI data in it wink Its kinda a pain in the arse, but if its a common thing, you could use the template editor and have it generate one for each one of your entities.

The other solution is to return a dataset by using a typedlist, then add your column like your normally do.

I havent attempted either of those, i am just randomly spurting out stuff i think might work wink Hope it helps ya!

Posts: 11
Joined: 29-Apr-2005
# Posted on: 04-May-2005 01:01:20   

Ahh! I think you're on to something. I didnt realize that a typed list is a dataset (I guess datatable acutally). Thats a perfect solution.

Thanks for the help!