Binding an Enhanced List at runtime


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
I'm trying to use a generic form to maintain several different tables in the database.  They all use the same form, but just different data sources.  What is the best way to do this in code at run-time instead of setting it through the designer at design time?  I figure I need to set some properties of the PopulationDataSourceSettings, but what I'm doing hasn't been working.  Here's the code I've got so far to bind the grid, and maybe someone can tell me what I have missing.

Public Class frmSFTableBase
   Public Sub New(ByVal HdrBO As BusinessLayer, ByVal HdrValue As String) 
      Me
.BusinessObjects.Add(HdrBO)
     
Me.grdHdr.PopulationDataSourceSettings.BusinessObjectType = "BBS.Biz.BizTypeBO"      Me.grdHdr.PopulationDataSourceSettings.ValueMember = HdrValue
     
Me.grdHdr.PopulationDataSourceSettings.MethodToExecute = "FillDataTable()"
     
Me.grdHdr.PopulationDataSourceSettings.DisplayFieldNames.Add(HdrValue)
      Me
.grdHdr.PopulationDataSourceSettings.FormatColumns.Add("{0}", MicroFour.StrataFrame.UI.ListViewColumnPopulationType.FormattedString)
      Me
.InitializeComponent()

End Sub

   Private Sub grdHdr_ListPopulating(ByVal e As   MicroFour.StrataFrame.UI.ListPopulatingEventArgs) Handles grdHdr.ListPopulating

       e.Parameters(0).Value =
"SELECT * FROM BizType"
 
End Sub

End Class

Replies
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, it looks like you have to populate a ListViewPopulationSettings object and then set it the listview property.  This now works for me:

PopSettings.BusinessObjectType = "BBS.Biz." & HdrValue & "BO"
PopSettings.DisplayFieldNames.Add(HdrValue)
PopSettings.FormatColumns.Add(
"{0}", MicroFour.StrataFrame.UI.ListViewColumnPopulationType.FormattedString)
PopSettings.FormatString =
"{0}"
PopSettings.MethodToExecute = "FillDataTable;System.String"
PopSettings.ValueMember = HdrValue
Me.grdHdr.PopulationDataSourceSettings = PopSettings


Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Yes, this is what we normally do as well.  Glad you got going. 
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