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

GridViewComboBoxColumn Ria DataBinding Silverlight 4

6 Answers 181 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Christopher Chenoweth
Top achievements
Rank 1
Christopher Chenoweth asked on 21 Apr 2010, 05:49 AM
Hello,

I've done quite a bit of research and would like to get a definitive answer on this.

I would like to simply bind a combo box in a radgrid that comes from a RIA Data Source.  I found someone who said to put the DomainDataSource into the Resources Section.  I was able to get their example to work with the regular combo box.  I would really like to use the Telerik version.

I have phone numbers in a table that have a type.  The PhoneType table has some values such as Home, Work, Cell, etc.  The Phone Table has a PhoneTypeID field.

The combobox should only show up on Edit and bind to the PhoneTypeID in the Phone Table.

This person had the best information I found on this:
http://msmvps.com/blogs/deborahk/archive/2009/11/25/silverlight-and-ria-adding-a-combobox-to-a-dataform.aspx

Can someone give me a project example or an easy way to do this that I am missing.

Thanks,
Chris

6 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 23 Apr 2010, 04:10 PM
Hello Christopher Chenoweth,

The attached project has a RadGridView bound to the Orders table of Northwind and a ComboBoxColumn showing Customers .
Both the RadGridView and the GridViewComboBox column are bound via DomainDataSource.

Regards,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Iosu Buenetxea
Top achievements
Rank 1
answered on 25 Apr 2010, 12:42 AM
Hi

Nice example..

But what about if the combobox has to be binded with customerID and Filtered  with customer.country = Order.shipcountry  row??

this is very common on a LOB when you don't want to show all the customers, You just want to show on the combobox the customers of the orders.shipcountry of the row.

I'm trying to do that, but I don't see where to put the  customer.country = Order.shipcountry
 
<telerik:GridViewComboBoxColumn ItemsSourceBinding="{Binding Data, Source={StaticResource ddsCustomers}}" DataMemberBinding="{Binding CustomerID}" DisplayMemberPath="ContactName" SelectedValueMemberPath="CustomerID" />


I have post a recuest for a example here:

http://www.telerik.com/community/forums/silverlight/gridview/can-you-add-this-to-the-demo.aspx


Thank you
0
Pavel Pavlov
Telerik team
answered on 28 Apr 2010, 04:51 PM
Hi JUAN CRESPO,

Please find the sample attached.
Here is the approach used:

I have added a Customers property to the Order entity. This property contains a list of customers filtered by the ship country.
This way in XAML I can bind the combobox column directly to this property like :

<telerik:GridViewComboBoxColumn DataMemberBinding="{Binding CustomerID}" DisplayMemberPath="ContactName" SelectedValueMemberPath="CustomerID" ItemsSourceBinding="{Binding Customers}" />

For the purposes of the demo I populate this property at the client via a small helper class. In  a real project you may find more reasonable to create and populate the property at the server side.


Greetings,
Pavel Pavlov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Iosu Buenetxea
Top achievements
Rank 1
answered on 29 Apr 2010, 11:51 AM

First.. THANK YOU VERY MUCH!!

After checking sample I have some suggestions.

 

1.- Don’t you think that you should add a easier way to implement this “feature”? Most of the LOB applications have this problem. There are dependencies between different comboboxes on a Grid (row or columns). There should be an easier way to do that. Maybe with a new property to filter the combo ?? In our application we are going to have this type of comboboxes on a grid on most of our grids (like 100).If you have to create a property on code this is going to be hard. Can you think about it? (note I have add a as suggestion on PITS 305234 )

 

2.- Also if we create the EF model correctly and we have an Entity that has a relation(navigation) with another Entity and we define on the “Datasources window” that we want the column “ContryID” to be a RadGridViewcombo (right now there is only an option to set the RadCombobox but it does not work) and the Orders to be a RadGRID. We should be able to Drag&Drop the RadGrid to a Page and the RadGrid should be able to do all the bindings automatically and to place the GridViewComboBox . Do you think? (note I have add as a suggestion on PITS 305224 )


3.- The idea is to avoid to use CODE... and have the most of the bindins and filters on  the XAML

I think your RADGridView is very powerful!!!! But for common task it should be easier to implement LOB scenarios…

 

Can you guys think about it??

 

Thank you very much

 

0
Jaan
Top achievements
Rank 1
answered on 24 May 2012, 09:46 AM
Ignore this post, I managed to fix it. Seems, that the logic for changes was somewhere else.

Jaan
0
Pavel Pavlov
Telerik team
answered on 24 May 2012, 01:34 PM
Hi,

Glad to know you have managed  to fix the issue. Any suggestions in this thread will be taken in concern for our very next planning.

Kind regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
Christopher Chenoweth
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Iosu Buenetxea
Top achievements
Rank 1
Jaan
Top achievements
Rank 1
Share this question
or