Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting List of Formatted Names
Message
From
24/12/2010 08:29:44
 
 
To
24/12/2010 07:59:06
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01493720
Message ID:
01493783
Views:
45
>>>Pretty simple really just add a property to your Entity that looks something like this. Since it accesses the other properties they will be hooked up to the data row. Now bind your drop down to this property rather than the others.
>>>
>>>Merry Christmas to you also.
>>>
>>>public string FullName
>>>{
>>>	get { return this.LastName + ", " + this.FirstName + " " + this.MiddleName; }			
>>>}
>>>
>>
>>:( Afraid there must be something more to it than that. I did as you said and I get this error:
>>
>>DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'FullNameLFM'.
>>
>>This is my code which I put in the AgentEntity.cs:
>>
>>
        public string FullNameLFM
>>        {
>>            get { return this.LastName + ", " + this.FirstName + " " + this.MiddleName; }
>>        }
>>
>>This is the dropdownlist definition:
>>
>>
            <mm:mmDropDownList ID="cboAgent" runat="server" BindingSource="Agent" BindingSourceDisplayMember="FullNameLFM"
>>                AutoPostBack="true" BindingSourceValueMember="AgentPK" BindingValueSource=""
>>                BindingValueSourceMember="">
>>            </mm:mmDropDownList>
>>
>>Is there something else for me to do or did I put this in the wrong place?
>
>Frank,
>
>I just tried this by adding this property in a PersonEntity that I have.
>
>public string FullName
>{
>     get
>     {
>          return this.LastName + ", " + this.FirstName + " " + this.MiddleName;
>     }
>}
>
>
>Then in a form I registerd the business object and called GetAllEntities. After looping through the entitylist, Printed out all the FullNames and it worked fine. See the code below which I put in a constructor just to try it. I would suggest you try this also to decide if the property works or if there is an issue with the way you are binding.
>
>
>public PeopleManger()
>{
>	this.oPerson = (Person)this.RegisterPrimaryBizObj(new Person());
>
>	InitializeComponent();
>
>	this.oPerson.GetAllEntities();
>	if (this.oPerson.Entity.HasValues)
>	{
>		foreach (PersonEntity entity in this.oPerson.EntityList)
>		{
>			Console.WriteLine(entity.FullName);
>		}
>	}
>}
>
>
>If that works then try binding it to a textbox or something less complicated than a drop down. Then if that works, will have to see why there is an issue in the binding of your drop down.
>Tim

Hi Tim,

I think the problem is with the binding. It is currently set like this:
BindingSource="Agent" BindingSourceDisplayMember="FullNameLFM"
But if I understand things correctly, this is trying to bind to the Agent, not the Agent.Entity. Is there a different way to bind a dropdownlist to an Entity List?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform