FieldName property not working on EnhancedList


Author
Message
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
That won't quite work. You're trying to use the BusinessObject.PrimaryKeyField as an Integer index into the DisplayFieldNames array.  It's just a string value for the Primary Key field name.  I guess I'm not understanding how these things work together.
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You could do it like this:

With Me.EnhancedList1.PopulationDataSourceSettings
    Me.GridView1.LocateByValue(0, _
       
Me.GridView1.Columns(Array.IndexOf(.FormatColumns.ToArray(), _
        "{" *
.DisplayFieldNames.IndexOf(BusinessObject.PrimaryKeyField).ToString() & "}")), Value)
End With

It will use the population data source settings to determine the column that contains the primary key field.


Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Ok, then how would you suggest that I accomplish this piece of code instead?  This is done at a base form level and I need it to be generic. I won't necessarily know what column number goes with what field or populated value.

gridView.FocusedRowHandle = gridView.LocateByValue(0, gridView.Columns(BusinessObject.PrimaryKeyField), Value)


StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, we name the colums Col# because each column can be a concatenation of multiple fields, and it is not always just one field.  The only way to determine which field is stored within which column is to check the population data source settings and see which column maps to which field.
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
When I try to access the FieldName property for a specific column in an EnhancedList control I am not getting the correct value.  I get Col0, Col1, Col2, and so on instead of the correct FieldName values.  I really need this as I would like to access a column based on the FieldName and I don't know what index it will be.  I tried this in DevExpress and it worked correctly, so it is probably something to do with what's going on in the Population of the grid from the BO.
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