> Hello,
> I have a multi-part question.
> Part 1: I have a listbox on a user control that I need to display a
> particular property of a custom object in for each object in an
> IList.
> (I know... huh?) Here is the idea with some pseudo
> -code.
> I have a method that returns an IList<CustomObj>. The CustomObj looks
> like the following:
> [Serializable]
> public partial class CustomObj
> {
> protected DateTime _createDate;
> protected DateTime _lastModifyDate;
> protected string _objName;
> protected int _objId;
> protected int _createByUserId;
> protected int _lastModifyUserId;
> [XmlElement(ElementName = "CreateDate")]
> public DateTime CreateDate
> {
> get
> {
> return _createDate;
> }
> set
> {
> _createDate = value;
> }
> }
> [XmlElement(ElementName = "LastModifyDate")]
> public DateTime LastModifyDate
> {
> get
> {
> return _lastModifyDate;
> }
> set
> {
> _lastModifyDate = value;
> }
> }
> [XmlElement(ElementName = "ObjName")]
> public string Name
> {
> get
> {
> return _objName;
> }
> set
> {
> _objName = value;
> }
> }
> [XmlElement(ElementName = "ObjId")]
> public int BrandId
> {
> get
> {
> return _objId;
> }
> set
> {
> _objId = value;
> }
> }
> [XmlElement(ElementName = "CreateByUserId")]
> public int CreateByUserId
> {
> get
> {
> return _createByUserId;
> }
> set
> {
> _createByUserId = value;
> }
> }
> [XmlElement(ElementName = "LastModifyUserId")]
> public int LastModifyUserId
> {
> get
> {
> return _lastModifyUserId;
> }
> set
> {
> _lastModifyUserId = value;
> }
> }
> public enum ObjFieldEnum
> {
> CreateDate = 1,
> LastModifyDate = 2,
> ObjName = 3,
> ObjId = 4,
> CreateByUserId = 5,
> LastModifyUserId = 6
> }
> }
> I first need to bind my listbox.datatextfield to the
> CustomObj.ObjName
> field. Which I believe I have accomplished but would be interested in
> some feedback.
> Secondly, and more importantly. I need to take all items that have
> been selected in the listbox and extract the associated ObjId for
> those items. This is where I have gotten stuck.
> Any advice would be greatly appreciated.
> Thanks in advance.
> rbr