Custom Fields


Author
Message
Ian Hammond
Ian Hammond
StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)
Group: Forum Members
Posts: 57, Visits: 277
Hi,

I am trying to populate a grid from 2 BO's by creating custom fields in the 'master' BO. My code for the custom field properties is :



#region " Custom Field Properties"

private const String constComputerName = "computerName";

private const String constLoggedIn = "loggedIn";

[
Browsable(false)]

[
BusinessFieldDisplayInEditor()]

[
Description("computerName")]

[
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

public String computerName

{

get { return this.CurrentRow[constComputerName].ToString(); }

set { this.CurrentRow[constComputerName]= value; }

}

[
Browsable(false)]

[
BusinessFieldDisplayInEditor()]

[
Description("loggedIn")]

[
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

public Boolean loggedIn

{

get { return (Boolean)this.CurrentRow[constLoggedIn]; }

set { this.CurrentRow[constLoggedIn] = value; }

}

#endregion



My form has the following event enabled:



private void hlsUserNamesBO1_ParentFormLoading()

{

this.hlsUserNamesBO1.FillUserNames();

this.hlsUserProfilesBO1.FillAllProfiles();

foreach (HLSUserNamesBO row in this.hlsUserNamesBO1.GetEnumerable())

{

this.hlsUserProfilesBO1.Filter= "userId = " + row.userId;

this.hlsUserNamesBO1.computerName = this.hlsUserProfilesBO1.computerName;

this.hlsUserNamesBO1.loggedIn = this.hlsUserProfilesBO1.loggedIn;

}

}



When I hit the assignment to computerName I get the exception

"Column 'computerName' does not belong to table HLSUserNames."

Can anyone please advise, many thanks
Replies
Ian Hammond
Ian Hammond
StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)
Group: Forum Members
Posts: 57, Visits: 277
Hi,

That info made quite a difference, thanks. I am still having problems populating the computerName and Logged in columns. I have used the listView row populating event as shown below:

private void listViewUserNames_RowPopulating(MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs e)

{

HLSUserNamesBO loBO= (HLSUserNamesBO)e.BusinessObject;

this.hlsUserProfilesBO1.FillProfileByUser(loBO.userId);

// e.Values[2].DisplayValue= this.hlsUserProfilesBO1.computerName;

// e.Values[3].DisplayValue= this.hlsUserProfilesBO1.loggedIn.ToString();

}

I have commented out the DisplayValue because they cause the exception:

Object reference not set to an instance of an object.

The e.Values has a count of zero.

I can't see what the demo does that I'm not can you please advise.


Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Very good Ian.

You don't need to do anything in the RowPopulating event.  I understand you want to display the ComputerName and LoggeIn values which are not part of the hlsUserProfilesBO1  BO, if so, you need to create those Custom Field Properties and suggested by Greg in the hlsUserProfilesBO1 BO, then in the ListView Populating Settings, you need to add those fields to the "Display Fields" listbox and then reference them in the "Columns" listbox with their index values (take a look at the image below).


http://forum.strataframe.net/Uploads/Images/4203e507-acd3-4782-bf1d-ffe5.png

P.S.
There are many ways to do this.  Look in the forums for Custom Field Properties, also in the help file.

Edhy Rijo

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