StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Column headers are not displaying...Expand / Collapse
Author
Message
Posted 09/02/2008 12:40:42 PM


StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 10/30/2008 12:11:21 PM
Posts: 11, Visits: 49
I have included some source code below which demonstrates what I'm attempting to do.  I have derived my own ListView control from the StrataFrame base ListView control.  I am attempting to dynamically build my column headers from the business object.  All of the data is populating in the business object without a hitch, but I'm having problems with getting the column headers to display properly.

(I learned most of what I'm doing from watching what StrataFrame creates in the form designer when I enter columns manually, etc.)

Any ideas where I might be going wrong?

public virtual void FillRows(MicroFour.StrataFrame.Business.BusinessLayer bo, string dataRetrievalMethodToExecute)

{

// set initial properties

base.SuspendLayout();

base.ListPopulating += new MicroFour.StrataFrame.UI.Windows.Forms.ListView.ListPopulatingEventHandler(OnListPopulating);

base.RowPopulating += new MicroFour.StrataFrame.UI.Windows.Forms.ListView.RowPopulatingEventHandler(OnRowPopulating);

base.AutoColumnSort = true;

base.AutoNavigateToSelectedRecord = true;

base.FullRowSelect = true;

base.GridLines = true;

base.View = View.Details;

// set up the business object

base.BusinessObject = bo;

// set up columns automatically

MicroFour.StrataFrame.UI.ListViewPopulationColumn OHRLVPopCol;

int i = 0;

string[] displayFields = bo.AllFieldsList.ToArray();

foreach (string field in displayFields)

{

base.Columns.Add(new ColumnHeader());

OHRLVPopCol = new MicroFour.StrataFrame.UI.ListViewPopulationColumn();

OHRLVPopCol.FormatString = "{" + i++ + "}";

OHRLVPopCol.PopulationType = MicroFour.StrataFrame.UI.ListViewColumnPopulationType.FormattedString;

OHRLVPopSettings.FormatColumns.Add(OHRLVPopCol);

}

OHRLVPopSettings.DisplayFieldNames.AddRange(displayFields);

OHRLVPopSettings.BusinessObjectType = bo.GetType().ToString();

OHRLVPopSettings.DropDownFormatString = "";

OHRLVPopSettings.FormatString = "{0}";

OHRLVPopSettings.MethodToExecute = dataRetrievalMethodToExecute + ";";

OHRLVPopSettings.ValueMember = bo.PrimaryKeyField;

base.PopulationDataSourceSettings = OHRLVPopSettings;

// fill the list view with x number of records

base.Requery();

base.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);

base.ResumeLayout();

// select the first element in the list view

if (Items.Count > 0)

Items[0].Selected = true;

}

Post #18911
Posted 09/02/2008 1:01:58 PM


StrataFrame Beginner

StrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame BeginnerStrataFrame Beginner

Group: StrataFrame Users
Last Login: 10/30/2008 12:11:21 PM
Posts: 11, Visits: 49
I figured this out.  Instead of doing
base.Columns.Add(new ColumnHeader());
within my loop, I am now doing
base.Columns.Insert(i, displayFields[i]);
and my column headers are appearing exactly as I want them to.
Post #18914
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 7:53pm

Powered by InstantForum.NET v4.1.4 © 2009
Execution: 0.109. 8 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.