Google Groups Home
Help | Sign in
Message from discussion ASP.NET listbox bound to IList<CustomObj>
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
rbr  
View profile
 More options Aug 28 2008, 8:02 am
From: rbr <ryankbr...@gmail.com>
Date: Wed, 27 Aug 2008 14:02:10 -0700 (PDT)
Local: Thurs, Aug 28 2008 8:02 am
Subject: ASP.NET listbox bound to IList<CustomObj>
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google