raghu

raghu

  • NA
  • 2
  • 0

binding combobox itemssource to dataview problem

Apr 21 2010 6:49 AM

hi,

I am binding datatable dataview to combobox.itemssource.

<ComboBox Grid.Column="1" DataContext="{Binding Source={StaticResource poDetails}}"  ItemsSource="{Binding}" DisplayMemberPath="po_no" SelectedValuePath="id" TabIndex="1" SelectionChanged="poNoComboBox_SelectionChanged"  Height="22" Name="poNoComboBox" Width="120" IsEditable="True" >

When i run in the combobox dropdown the items populated are system.data.datarowview instead of the value of po_no.

To work around this problem i set path as po_no

<ComboBox Grid.Column="1" DataContext="{Binding Source={StaticResource poDetails}}"  ItemsSource="{Binding Path=po_no}" DisplayMemberPath="po_no" SelectedValuePath="id" TabIndex="1" SelectionChanged="poNoComboBox_SelectionChanged"  Height="22" Name="poNoComboBox" Width="120" IsEditable="True" >

Now the combobox items are populated by values of po_no but selectedvalue is not set when i select a combobox item its always null.

Can anyone plz help me with this.

Thank u

Raghu


Answers (1)