This is a migrated thread and some comments may be shown as answers.

RadGridView binding to LLBLGen Entity Collections Master Detail / Updates

12 Answers 349 Views
GridView
This is a migrated thread and some comments may be shown as answers.
erwin
Top achievements
Rank 1
Veteran
Iron
erwin asked on 23 Jul 2008, 06:38 PM
Has anybody managed to bind the Grid View in Master/Detail to LLBLGen
related EntityCollections with Edit / Insert / Delete enabled and
database-generated ID fields?

If so, I'd be interested in some code examples - or some hints about how to
implement insert of detail records to new master records (that have no ID yet)
and the implementation of deferred delete logic.

Regards
Erwin



12 Answers, 1 is accepted

Sort by
0
Dimitar Kapitanov
Telerik team
answered on 08 Aug 2008, 12:51 PM
Hi erwin,

I am sorry for writing just now - I needed some time to prepare the example for you.

Attached you will find a small and simple solution that demonstrates how RadGridView displays and handles hierarchical data that comes from a LLBLGen generated DAL. To run the sample application, you will need to have a distribution of LLBLGen Pro ver.2.6 and RadControls for WinForms Q2 2008 (ver.7.0.0.0.0) installed.

Please give us your feedback on what else should be demonstrated and/or enhanced in the provided example.
 

Sincerely yours,
Dimitar Kapitanov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
erwin
Top achievements
Rank 1
Veteran
Iron
answered on 09 Aug 2008, 08:20 PM
Dimitar, thanks for the sample.

What is unclear to me:

when I insert a new row in the master table, how can I then insert new rows
into the detail table.

how should I handle deletes

how should I handle ID columns generated by the database

I have some constraints on the child table (some values should be unique
within all child records. Where's the best place to add checking and error
handling code?

Basically what I'm looking for is a user-friendly master/detail grid
layout that allows CRUD on the master and and detail tables.

regards Erwin




regard

Were some issues fixed on 2008Q2 because even my old code that threw
errors on Q1 seems to work now (at least for displaying).

regards
erwin




0
Dimitar Kapitanov
Telerik team
answered on 11 Aug 2008, 01:26 PM
Hello Erwin,

The task of inserting the rows is relatively easy. You need to use the GridViewRowCollection and its methods like:

You can access the GridViewRowCollection  on the level to be modified through the property Rows of the RadGridViewTemplate instance that handles the respected level. In case of the second level for example you get the second level template from the ChildGridViewTemplates property of RadGridVIew's MasterGridViewTemplate property. The whole idea is that the template hierarchy is organized into "parent-child" manner - the "parent template" has a ChildGridViewTemplates that on its turn contains the "child" templates.

So the GridViewRowCollection  has a method with the following signature:
public GridViewDataRowInfo AddNew(GridViewDataRowInfo parent) 
where you give the "master" row instance and the method returns a reference to a newly created "child instance". All fields that are generated by the data base like IDs are pre-populated and available

Also you can tune the behavior of the new row through the event DefaultValuesNeeded event exposed by the RadGridView component.


The delete operation is handled again through the Rows collection with the methods:
public bool Remove(GridViewDataRowInfo item) 
public void RemoveAt(int index) 

Also you can put/execute your logic regarding the child rows in the event RowsChanging event exposed by the RadGridView component. You can cancel the update there. Also through the arguments you can see the type of the operation (insert, delete, clear, etc.) and the template that owns the Rows collection (thus providing the context of the level in the hierarchy).

If there is anything else we can help with, do not hesitate to contact us.

Best wishes,
Dimitar Kapitanov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
erwin
Top achievements
Rank 1
Veteran
Iron
answered on 11 Aug 2008, 02:33 PM
Thanks for the reply. However, I don't want to add a new row by code.

The question is/was:

How can I configure the grid so that if the User adds a new master record,
he can then expand the hierarchy and add child records to the newly created
master record.

Some functional sample code, where the user can actually create, update,
insert and delete master and details rows (plus all combinations)
through the UI would help me a lot.


Erwin
0
Dimitar Kapitanov
Telerik team
answered on 14 Aug 2008, 07:59 AM
Hi Erwin,

At present, you have experienced one of the design limitations, which should be addressed for the Q3 release. We assumed (for optimization reasons) that when there are no child rows no  expansion should occur, thus rendering the visual building of a hierarchy impossible. This will be corrected through a property that sets which behavior is to be used. Please give us your feedback on this approach.

Kind regards,
Dimitar Kapitanov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
erwin
Top achievements
Rank 1
Veteran
Iron
answered on 19 Aug 2008, 10:39 PM
Have to say, I'm disappointed, that everywhere where I do a little bit
more than just scratching the surface of RadControls for WinForms
I run into what you call "Design Limitations".


0
Vassil Petev
Telerik team
answered on 21 Aug 2008, 03:44 PM
Hello erwin,

This is indeed a design limitation, albeit if I had to reply to your previous reply, I would have said it in another way.

The ability to create, update, insert and delete rows when there are no children in the hierarchy is not present in the current version of the control. This is a very valid feature request, which we plan to implement for the next major version of RadGridView. I suspect that this is an important feature for you, and I can provide you with a pre-release version of this feature as soon as it is ready. Of course, we would be happy to hear your comments about the implementation Dimitar suggested so that we take care of this limitation.


Best wishes,
Vassil
Unit Manager
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
erwin
Top achievements
Rank 1
Veteran
Iron
answered on 21 Aug 2008, 04:29 PM
Hi Vassil,

I'm currently developing a design study for a new version of a PC inventory system. Can upload some screenshots if you are interested.
The projects is at a stage where you get the WOW effect, similar to looking
at the demos of RadControls, but when it gets to actually implement functionality or when I demo the prototype with users of the old system which is based on the standard .net controls, there are nasty bugs and limitations creeping up - see my bug reports.

This is a bit frustrating, and sometimes I this leaks through when I put a reply here or file a bug report.

regards
Erwin
0
erwin
Top achievements
Rank 1
Veteran
Iron
answered on 21 Aug 2008, 07:04 PM
As for your suggestion about prelease of the RadGridView, I'd give the pre-release version a try, but can not promise thorough testing, because I can't predict resource planning for this UI design study, also I would probably need some support on how to implement binding to the LLBLGen OR mapper.

Regards
Erwin
0
Vassil Petev
Telerik team
answered on 26 Aug 2008, 07:44 AM
Hi erwin,

We will be able to assist you with LLBLGen Pro - this won't be a problem.

I would also like to review the screenshots you mentioned - please, forward them to VPETEV at Telerik COM. We are looking for rich applications, created by our clients. Let's discuss this, and some other ideas through mail - hopefully we will be able to help you out.


Sincerely yours,
Vassil
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ramius
Top achievements
Rank 1
answered on 19 Jan 2009, 03:01 PM
Hello,

i also need the feature Erwin asked for. ( The ability to create, update, insert and delete rows when there are no children in the hierarchy  )

Do you have a timeframe when it will be available ?

Greetings,

Ramius
0
Nick
Telerik team
answered on 20 Jan 2009, 03:57 PM
Hi Ramius,

Thank you for your feedback. We currently do not have a specific target release however we always determine the priority of a new feature based on customer demand.

Thank you for your vote, we will raise the priority for this feature. Do not hesitate to write us back if you have more questions.

Best wishes,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
erwin
Top achievements
Rank 1
Veteran
Iron
Answers by
Dimitar Kapitanov
Telerik team
erwin
Top achievements
Rank 1
Veteran
Iron
Vassil Petev
Telerik team
Ramius
Top achievements
Rank 1
Nick
Telerik team
Share this question
or