Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
Copper Contributor
Posts: 22
Registered: ‎08-17-2009

Filling a combobox? ListBox?

Trying to fill a combobox with a list of UserNames from the UserInfo table. 

 

Most of the code below works fine, except when I add in the line indicated I get this error:

 

A smart part associated with this page has failed to load: c:\Inetpub\wwwroot\SlxClient\SmartParts\AccountSamples\AccountSamplesDetails.ascx(367): error CS1061: 'System.Web.UI.WebControls.ListBox' does not contain a definition for 'TextField' and no extension method 'TextField' accepting a first argument of type 'System.Web.UI.WebControls.ListBox' could be found (are you missing a using directive or an assembly reference?)

 

But the intellisense for the "combobox" control lists TextField?

 

Sage.Entity.Interfaces.IAccountSamples thissample = BindingSource.Current as Sage.Entity.Interfaces.IAccountSamples;

Sage.Platform.RepositoryHelper<Sage.Entity.Interfaces.IUserInfo> rep =
 Sage.Platform.EntityFactory.GetRepositoryHelper<Sage.Entity.Interfaces.IUserInfo>();

 

Sage.Platform.Repository.ICriteria criteria = rep.CreateCriteria();
criteria.Add(rep.EF.Eq("Available",true));
criteria.AddOrder(rep.EF.Asc("UserName"));

System.Collections.Generic.IList<Sage.Entity.Interfaces.IUserInfo> iuser = new
 System.Collections.Generic.List<Sage.Entity.Interfaces.IUserInfo>();

 

iuser=criteria.List<Sage.Entity.Interfaces.IUserInfo>();

 

cboRequestedUser.TextField = "UserName";  //this line throws error.
cboRequestedUser.ValueField = "UserName";


cboRequestedUser.DataSource = iuser;
cboRequestedUser.DataBind();

 

It's also odd that when I hover over the code snippet it is referred to as an IListBoxControl

Highlighted
Employee
Posts: 320
Registered: ‎03-30-2009

Re: Filling a combobox? ListBox?

Try

 

cboRequestedUser.Items.Add("UserName");