Combo box combine text from multiple fields

2 posts, 0 answers
  1. Farhan
    Farhan avatar
    39 posts
    Member since:
    Aug 2011

    Posted 06 Sep 2011 Link to this post


       I have a combo box in the edit Form in a radgrid. Im using Entity Framework and a business layer class to return an IEnumerable List
    <Employees> to bind to the grid. When the edit form comes up I want the titles and names of the employees to be shown in the combo box. like as the  DataTextField like :

    "{Title}:" + {FirstName}  + " " + {LastName}

    and I want to bind another property in the Employee class employee_Id as the DataValueField.

    Can someone show me how to do this, I am doing something similar in a GridCalculatedColumn where I am able to combine these multiple fields and show them in an expression like shown above. Please see Grid calculated column below. How can I bind the combo box like this so i can see the title: FirstName  Lastname  in the text field. Please note that I dont want a multi column grid as shown in this example here  

    I want to show them all together. and be able to bind the employee_id property as the DataValueField so when i submit the form I can read that, can someone please show me how to do this in code, thanks.   Please see below for the CalculatedGridColumn where i am showing same information.

    <telerik:GridCalculatedColumn SortExpression="Employee.FirstName" HeaderText="Employees" AutoPostBackOnFilter="true"
     DataFields="Employee.Title,Employee.FirstName, Employee.LastName" Expression='{0}  + ":" + {1} + " " + {2}' >                        
     <HeaderStyle HorizontalAlign="Left" Width="30%" />
                             <ItemStyle HorizontalAlign="Left" />
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 06 Sep 2011 Link to this post

    Hello Farhan,

    You could use the custom attributes to achieve your functionality. You can fine the more information from here.

    Custom Attributes.
    ComboBox / Custom Attributes .

Back to Top