Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
My Other Picker is Pickier
Message
From
11/05/2005 09:58:51
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01011435
Message ID:
01012841
Views:
21
This Picker is being used as a ForeginKey lookup of a CompanyName from the Company business
object that is designated a child of the Visitor business object
(Me.oVisitor.RegisterChildBizObj(Me.oCompany)).
The Picker "Text" property would then represent the current Visitor (RegisterPrimaryBizObj)
business object's ComapnyName.

My Goals:
UI Has three tabs on one form - Visitor, Company and Visits
Visitor Tab is where a Visitor is selected from a navigation grid and then the corresponding
visitor details display below. Included is a VisitorCompanyNamePicker (FK to Company).
Company Tab is where the selected visitor's Company details are displayed.
Visits Tab is where the selected visitor's Visits are displayed.
When I change the company assigned to a Visitor via the VisitorCompanyNamePicker I would
expect that the Company tab would change also to reflect the newly selected Company (and
it's details).

Current Configuration:
Visitor is both the Primary and registered as the parent business object on the form.
Company is registered as a child business object of Visitor on the form.
Visit is registered as a child business object of Visitor on the form.

The Company Business Object has its HookParentNavigated and HookParentRetrieved events
configured to call Me.GetCompanyByVisitorId(e.PrimaryKeyValue)
The Visit Business Object has its HookParentNavigated and HookParentRetrieved events
configured to call Me.GetVisitsByVisitor(e.PrimaryKeyValue)

The VisitorDataset is filled with all Visitors after InitializeComponent in the form's
constructor while the Company and Visit datasets are only filled after hook events.

Company business object constuctor includes:
        Me.TableName = "Companies"
        Me.PrimaryKey = "CompanyName"
        Me.DescriptionField = "CompanyName"
        Me.ForeignParentKeyField = "VisitorId"
        Me.AutoCancelOnParentCancel = True
        Me.AddBrokenRulesToParent = True
        Me.AutoCheckRules = True
Visit business object constructor includes:
        Me.TableName = "Visits"
        Me.PrimaryKey = "VisitId"
        Me.DescriptionFields = New String() {"VisitId", "VisitorId", "EmployeeId"}
        Me.ForeignParentKeyField = "VisitorId"
        Me.AutoCancelOnParentCancel = True
        Me.AddBrokenRulesToParent = True
I have wired up the following events for testing:
VisitorCompanyNamePicker_Validating (called when saving)
VisitorCompanyNamePicker_Validated (called when saving)
VisitorCompanyNamePicker_ItemSelected
VisitorSaveButton_Click
VisitorNewButton_Click

The test code to determine values in the Picker's Text property and BO value:
Dim CompanySelected As String = Me.VisitorCompanyNamePicker.Text
Dim VisitorCompanyName As String = Me.oVisitor.DataRow.Item("CompanyName").ToString
I have tried all of the following bindings without success:
1. Original (copied method used for binding FK columns in combo boxes):
BindingSource: Company
BindingSourceMember: CompanyName
BindingValueSource: Visitor
BindingValueSourceMember: CompanyName

Results:
Right up to calling Me.oVisitor.SaveDataSet(Me.oVisitor.GetCurrentDataSet()), the values
stored in the CompanySelected and VisitorCompanyName are correctly valued with the Company
selected in the Picker.
When performing an update NO error is encountered.
When performing an insert I get Cannot Insert NULL into CompanyName

2. Your Recent Suggestion
BindingSource: Visitor
BindingSourceMember: CompanyName
BindingValueSource:
BindingValueSourceMember:

Results:
Right up to calling Me.oVisitor.SaveDataSet(Me.oVisitor.GetCurrentDataSet()), the values
stored in the CompanySelected is correctly valued with the Company selected in the Picker.
The VisitorCompanyName reflects NULL or ""
When performing an update or insert I get Cannot Insert NULL into CompanyName

3. Just a Logical Possiblity
BindingSource: Visitor
BindingSourceMember: CompanyName
BindingValueSource: Visitor
BindingValueSourceMember: CompanyName

Right up to calling Me.oVisitor.SaveDataSet(Me.oVisitor.GetCurrentDataSet()), the values
stored in the CompanySelected and VisitorCompanyName are correctly valued with the Company
selected in the Picker.
When performing an update or insert NO error is encountered but the Company navigation
broken - new company reflected on Visitor based tab but old company (or no company when new)
reflected on Company based tab.

4. Just another Logical Possiblity
BindingSource:
BindingSourceMember:
BindingValueSource: Visitor
BindingValueSourceMember: CompanyName

The Picker is empty when navigating records (obviously as it has no binding source).
Right up to calling Me.oVisitor.SaveDataSet(Me.oVisitor.GetCurrentDataSet()), the values
stored in the CompanySelected and VisitorCompanyName are correctly valued with the Company
selected in the Picker.
When performing an update or insert NO error is encountered but the Company navigation
broken - new company reflected on Visitor based tab but old company (or no company when new)
reflected on Company based tab.
THANKS
Joe Salvatore, Programmer/Analyst - The Stellar Group
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform