Executive Summary: How do I dynamically/programmatically change the .ParentRelationship property on an ASPX codebehind page as it loads? Details: I thought I would be able to populate the ParentRelationship property dynamically using the string that appears after using the builder … unfortunately though, as my accounting teacher stated, “Ignorance is bliss … but only for a time”. MailAddr.ParentRelationship = "Person, (iID) <--> (iPersonFK)" MailAddr = "Company Location, (iID) <--> (iCompanyLocationFK)" MailAddr.ParentRelationship = "Courthouse, (iID) <--> (iCourthouseFK)" MailAddr.ParentRelationship = "Employee, (iID) <--> (iEmployeeFK)" MailAddr.ParentRelationship = "Investigator, (iID) <--> (iInvestigatorFK)" Further testing simply served to illustrate the level of my ignorance … not to mention short lived blissfulness. I soon discovered that this property is really a reference to an object of the following nature: MicroFour.StrataFrame.Business.BusinessParentRelationship A short hunt through the code brought me to this Public Interface: Namespace Business Public Interface IBusinessParentRelationship #Region " Properties " Property ParentBusinessObjectType() As String Property ParentPrimaryKeyField() As String() Property ForeignKeyField() As String() #End Region #Region " Methods " Function Clone() As IBusinessParentRelationship #End Region End Interface End Namespace
At this point, my ignorance kicked in again and I was hopeful that I could simply assign a string to these properties and then assign that object to the .ParentRelationship property of the MailingAddress business object. Silly boy … as “value of type string cannot be converted to a one dimensional array of string”. Sigh oMailingAddress.ParentBusinessObject = oPerson Dim oPersonMARel As New MicroFour.StrataFrame.Business.BusinessParentRelationship oPersonMARel.ForeignKeyField = "iPersonFK" oPersonMARel.ParentPrimaryKeyField = "iID" oPersonMARel.ParentBusinessObjectType = "IMA.BOLibrary.Person" oMailingAddress.ParentRelationship = oPersonMARel Ok, I says to myself … much less confident in my ability to do anything at this point other than poo in my shorts … let’s try this: oMailingAddress.ParentBusinessObject = oPerson Dim oPersonMARel As New MicroFour.StrataFrame.Business.BusinessParentRelationship oPersonMARel.ForeignKeyField(0) = "iPersonFK" oPersonMARel.ParentPrimaryKeyField(0) = "iID" oPersonMARel.ParentBusinessObjectType = "IMA.BOLibrary.Person" oMailingAddress.ParentRelationship = oPersonMARel But, alas, no, as it is obvious I don’t know how to deal with one dimensional arrays of type string. So, I fall back to your expertise. How do I dynamically change the .ParentRelationship property on an ASPX page? CT |