This is a migrated thread and some comments may be shown as answers.

[Solved] Combobox in DataGrid validation

2 Answers 118 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
karl
Top achievements
Rank 1
karl asked on 30 Nov 2010, 03:16 PM
Hi,
A Gridview is bounded to a DomainDatasource (Machines) with AutoLoad=True. That Machines Entity has a BuildingId property which shows the joined Building entity's ID. I would like to have a simple lookup for Buildings so my gridview has a ComboboxColumn to show the available Buildings.  
<telerik:GridViewComboBoxColumn Header="Building" UniqueName="comboboxcolumnindatagrid1"  DisplayMemberPath="Name" SelectedValueMemberPath="Id"/>
This Combobox is populated from GridView's DataLoaded event manually from BuildingSource Domaindatasource:
private void GridView_DataLoaded(object sender, EventArgs e)
{
            GridViewComboBoxColumn comboColumn = GridView.Columns["comboboxcolumnindatagrid1"] as GridViewComboBoxColumn;
            comboColumn.DataMemberBinding = new Binding("Building");
            comboColumn.ItemsSource = BuildingSource.Data;
        }
The Combobox appears and populated with Buildings properly, but when I select another Building then a ValidationError appears. Does it validate the DisplayValueMemberPath instead of SelectedValueMemberPath? How can I solve this issue?
(Error is: "Input is not in correct format")
Thanks in advance,
sosenk

2 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 30 Nov 2010, 04:15 PM
Hi karl,

Here you can find more information about our GridViewComboBoxColumn and the various supported examples. 

I believe that you should set SelectedValueMemberPath to the name of the Id property of your Building entity. Once you do that the cell value should update without any problems.

Greetings,
Milan
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
karl
Top achievements
Rank 1
answered on 01 Dec 2010, 09:39 AM
Hi,
I have checked my code based on your linked docs and now it is working fine.
Ma DatamemberBinding property was set incorrectly.
Thanks,
Sosenk
Tags
GridView
Asked by
karl
Top achievements
Rank 1
Answers by
Milan
Telerik team
karl
Top achievements
Rank 1
Share this question
or