views:

141

answers:

2

I want to bind data(For ex: Employee name, Employee ID from Employee) to a dropdownlist and the data should be displayed in dropdownlist as two columns. I don't want to separate this columns by using any special characters like | or '-'. I want to display them as different columns in a dropdownlist.

How can i achieve this using .net and the data i need to retrieve using SQL server 2008.

A: 

Is this a WPF ComboBox? If so, use the ItemTemplate:

<ComboBox Height="23" Width="25" ItemsSource="{Binding Clients}" 
          SelectedValuePath="Client" SelectedItem="{Binding Client}">
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <!-- Configure as required -->
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}" />
                <TextBlock Text="{Binding Id}" />
             </StackPanel>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>

Of course you have to format your StackPanel (or Grid, ...) to get desired output.

Si
Hi..Si..thanks for the reply..it is a asp combo box not an WPF...
karthik
No problem, asp.net tag added to question.
Si
A: 

This and this should be useful

EDIT: After seeing the comments. This link is probably what you want.

lalli