Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why this cast in mmbindingstrategy.cs?
Message
From
31/08/2004 11:49:38
Max Fillmore
Essential Skills, Inc.
Lenexa, Kansas, United States
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00937866
Message ID:
00938059
Views:
19
Thanks, Kevin.

I have resorted to reading the source code because I am extremely frustrated trying to get this framework to do what I need it to do.

Specifically I have a form class in VB.NET based on the mmBusinessForm. To this form I have added an mmTabControl with 3 mmTabPage(s) labled "Query", "List", and "Details". I'm sure you know what that's about. The List page contains a mmButtonNew and an mmButtonDelete. The Details page contains an mmButtonSave and an mmButtonCancel. I then use this QueryListDetailsForm.vb as the class for table maintenance forms. I put an mmDataGrid on the Lists page and bind it to the primary business object and put as many mm* Windows forms controls as required on the Details page.

This form has worked well and I have built about 30 different maintenance forms on it. However I can't make this work for a parent child form. In my specific case the Primary business object is call "BTS". I have a child business object, "Carrier". Following the example of the OrderDetails business object the Carrier constructor has the following:
Me.TableName = "Carrier"
Me.PrimaryKey = "Carrier_Id"
Me.DescriptionField = "Carrier_Number"
Me.RetrieveAutoIncrementPK = True

Me.AutoSaveOnParentSaved = True
Me.AutoCancelOnParentCancel = True
Me.AutoDeleteOnParentDeleted = True
Me.AutoEmptyOnParentAdded = True
Me.ForeignParentKeyField = "bts_id"

This Carrier class also has HookParentRetrieved() and HookParentNavigated() overides to populate the dataset with the children having the passed bts_id.

This child business object is registered as the child of the BTS object and is the Binding Source of another mmDataGrid on a mmGroupBox on the Details page of my form. Also in that group box I have a mmButton labeled New which passes the CarrierDefaultValues object to NewRow so that the ForeignParentKey gets populated:

Me.NewRow(Me.oCarrier, New CarrierDefaultValues(oBts.DataRow("bts_id")))
Me.grdCarrier.NavigateData(mmNavigate.Last)

I need to edit 2 columns of data displayed in the grid so I have also placed a mmTextBox control for the Carrier_Number column and a mmComboBox control for the Channel_Number column onto the mmGroupBox which contains the grid and buttons. I put the controls here so I could use a combobox for the channel_number which is from a related table. My users can't remember these and need the picklist. The combobox is populated by its own business object.

When I add a new row to the oCarrier business object with the New button click the row appears in the child grid with blank values in the carrier_number and channel_number columns. I can then edit these values in the mmTextBox and mmComboBox which are alse bound to the Carrier business object. So far so good.

In the Validated methods for the textbox and combo I refresh the child grid control and I can see the entered values in the grid. When I click the Save button everthing seems to be working. I have a HookPreSave in my form where I look at the datarows of the Carrier object. The new row and the new values are there. In my CheckRulesHook of the carrier class I can see that the new values there as well. BUT BUT BUT when the save is all done SQL-Server shows that the new row has nulls in both the carrier_number and channel_number columns.

I have tried everything I can think of and NO-DICE. This seems like a pretty common requirement. It would be nice if there were a working sample. In lieu of that can you tell me what I might be doing wrong? Please help. I could lose the project and the client.

Thanks.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform