How to synch a DataGridView in a SF Maintenance Form with a single BO?


How to synch a DataGridView in a SF Maintenance Form with a single BO?...
Author
Message
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi

I am working on a form below and I want to provide the user with a readonly datagridview so they can just click the selected record and then show that record at the bottom for maintenance. 

Right now, the datagridview control is not responding to the navigation events. I found this old post http://forum.strataframe.net/Topic9799-7-1.aspx?Highlight=datagridview, but I am not sure is this has been fixed?

Is the datagridview control suppose to respond to the navigation events automatically or do I have to change some properties to make it work?

Thanks!

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I wouldn't use a data grid view.  Use a ListView and handle the SelectedIndexChanged event and then navigate to that record.  Obviously you can use grids, but I would not recommend doing this throughout your applicaiton.  If you are going to have a read-only list that is presenting child records for an end-user to select, I recommend using the ListView everytime.  Less overhead, faster, and fewer quirks! Smile
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Trent,

I had implemented ListView in a previous test project, but I found I had to do many little steps in order to make it work, beside having to format all listview columns. 

I am testing now with the grid and it looks easier to handle, except that it is not working with the navigation events.  I have many forms to do and I am in the process of choosing which control to use based on which one will take less time to implement and easier for me to remember many little steps or a lot of copy and paste. Wink

Back to the situation, will the datagridview works or not with the navigation bar?

Or will this be easier with a 3rd party grid from DevExpress? (I have not tried it yet)

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
To each his own...BigGrin  You can create a class to aid in some of the steps...we have had really good luck with this approach in our medical software...we went down the data grid view in the beginning too Smile

Look at the Business Binding Source sample that comes with the framework and it should get you going in the right direction.

Whether you use a 3rd party grid or the data grid view you should have the same behavior.

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Ben Hayat (06/26/2007)
Robin J Giltner (06/26/2007)
Well IncludeinFormNavigate is set to PrimaryBusinessObject. In fact all of the Includes are set to PrimarybusinessObject save for the Save, which is set to AllBusinessObjects.

I started messing around some, and it seems like when I removed the MaintenanceFormToolStrip from its container, and just placed it on the form, it started working.

Thanks

Robin Giltner


Robin; this is something I had recently discovered and reported it [I'm not sure if it was recorded]. The problem I ran into, was using the SF Maintenance form and BBS. Somehow, the BBS does not work with toolstrip. However, if you create a new STD SF form, place a header and toolstrip on it manually, then you'll see everything works.

Hope this helps!

Trent,

I am sorry to insist on this one, but apparently the problem with the Maintenance Form reported by Ben Hayat on 6/26/2007 still exist.

I tried Ben's test with a standard form and the datagridview is working as expected.  I would really appreciated if you can check this out to see how to make all this work as expected.

Edhy Rijo

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Edhy,



I use the ListView for this all the time. In fact I sub-classed the ListView just for this and it is pretty easy to use now. A few of things I ended up doing:



- I fill the list view with a copy of the BO i'm working with. I.e. I use the CopyDataFrom() method.

- In my subclassed BO, I have a property to indicate the BO to synch with. The property is a BusinessLayer type, so any BO will work.

- I handle the several of the BOs events:

* AfterAddNew - update list and synch it to BO

* AfterDelete - Update list and synch it to BO

* AfterSave - Update list and synch it to BO (in case the data in list has changed).

* Navigating - check if bo needs to be saved before navigating to off record

* Navigated - synch list

* CurrentDataTableRefilled - update list and synch to BO

- I handle a couple of the ListView events:

* SelectedIndexChanged - navigate BO to associated item

* ListPopulating - set parameters needed for the CopyDataFrom method, which is possible because I have the BO property of the ListView.



Anyway, just some thoughts if you go down the ListView road.... BigGrin

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Greg,

Thanks for the info.  The problem here is that I am a real novice in VB.NET.  Today it took me a couple of hours to create my own code snippet using the help file and then I got a sample snippet and finally I got my very first snipet. 

About classes and sub-classes still I have not played with them, I can manage to work it out better with a startup sample and that is how I have been able to get through my learning curve.

I have used the ListView in my first test project with a couple of forms and end up copying/pasting a lot of stuff from one form to the other.  I will review it again with your recomendations and see how far I can go.

Edhy Rijo

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I totally understand. I was there not so long ago. It's very cool when it starts to click BigGrin.



If I get a chance, I'll post the control in a sample app next week...no promises, it's been busy.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Edhy,

There is an issue that has not bee fixed as it related to bubbling up the events (this has been discussed) but this really isn't a show stopper in most cases.  Here is the deal, a grid, report, etc. expects to talk to an object model that implements the IBIndingList interface.  So this is what the business binding source does.  It allows you to wrap a BO and then creates a unique BO instance for each row that emits the proper row reference.  This is what a grid wants...so the issue is that the parent business object (the instance being wrapped) works fine, but the events for each internal BO do not bubble up to the parent...but this will only effect events such as the field changed event, etc.  The Navigated event of the instance being wrapped should be getting raised.

It is on the slate to make this bubble up change before the next update...but I will take a look at this next week and see how much time will be involved in making this change and see if I can plop something out here.  The reason this isn't high on our list is that this is generally not an issue in most circumstances....thus the priority on this enhancement is pretty low since there are so many other ways to address this.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Oh, I just noticed what you were referring to on Ben Hayats post...the BBS was never intended to interact with the MaintenanceFormToolstrip in that manner.  I see why you are wanting to do that, but this has more to do with the grid rather than the navigated event.  Each grid is slightly different in the way that it determines the "active" row.  This is why most developers implement their own grid navigation logic here.  Also, if you are using a grid for a child data source, in most cases it is being presented to allow the end-user to select the child record, which DOES fire the navigated event in the BO.  It is working backwards that you are wanting.  I will look at this, but that is why it was not changed.  Ben Hayat kept demanding that we make a change, but this change entailed more than just an encapsulated change. 

I will look at this again and refresh my memory, and it is still in a list that we keep up with, but that is the issue.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search