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

GridViewComboBoxColumn - Can't get it to work

5 Answers 96 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.
Vamshi
Top achievements
Rank 1
Vamshi asked on 28 Mar 2012, 07:22 PM
Hi,

I have a GridView with a few GridViewComboBoxColumn(s). I can't get it to work so that when the gridview is bound, the Combobox column displays the correct value for that field from the drop down and also update the underlying item when I pick a new value. Here is a sequence of my code:

1. Here is a declaration of the column:

 

 

<telerik:GridViewComboBoxColumn UniqueName="ThirdPartyNew" Header="Third Party New" IsGroupable="False" Width="120" SelectedValueMemberPath="ID" DisplayMemberPath="Name" DataMemberBinding="{Binding ThirdPartyID, Mode=TwoWay}" IsFilterable="False" />

2. Then in the 'OnNavigatedTo' event, I Bind my gridview to a collection of my business objects. One of these is the field that is represented by the above combobox column.

3. In the 'DataLoaded' event of the GridView, I bind the comboboxcolumn as follows:

 

deExtenderClient.GetAllThirdPartiesCompleted += (s2, ea2) =>
{
       (rgvOrdersEdit.Columns["ThirdPartyNew"] as GridViewComboBoxColumn).ItemsSource = (List<DEExtenderDataServiceRef.Agency>)ea2.Result;
};
deExtenderClient.GetAllThirdPartiesAsync();

This however doesn't work. When I run the app, the column is empty to begin with. When I edit the column, I do see the combobox filled with items. But When I select and tab out, it doesn't display anything.

Pl help!
Thanks!

 

 

 


5 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 02 Apr 2012, 03:43 PM
Hi Vamshi,

I presume that this issue is related to a known problem of RadComboBox that can be reproduced in certain scenarios, when SelectedValue binding is triggered before the ItemsSource is set. Would you please try binding the ItemsSource to your ViewModel and confirm whether the issue persists after such a change. In case that it is not possible to bind the ItemsSource, please send us a runnable project via support ticket, so that we could debug it on our side and give you an appropriate solution.

Greetings,
Ivan Ivanov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Vamshi
Top achievements
Rank 1
answered on 02 Apr 2012, 08:44 PM
Hi Ivan,

Thanks for the reply. I have an open ticket for this issue. I just posted a reply to that with a sample project attached. The ticket ID is 528488. Can you please go into the ticket system and look at it?

A quick summary - I am new to Silverlight projects so am not very familiar with the View Model approach. Besides, I am working with an existing application, that is currently coded in ASP.NET AJAX. We plan to move that app to Silverlight. So I have to use the existing code including the DB access code, my logic processing code, my business objects etc. As you can see, changing the approach all together might be a problem because I don't have that kind of a bandwidth. Pl read my reply in the ticket above where I have explained my current approach/architecture for this app.

Thanks!
0
Ivan Ivanov
Telerik team
answered on 03 Apr 2012, 07:19 AM
Hi Vamshi,

I have looked through the support ticket you have mentioned in you post and I understand your concerns about changing the architecture. Would you please try binding the RadComboBox's SelectedValue property at run-time, just after its ItemsSource is loaded, by using the same binding as its respective column's DataMemberBinding?

Kind regards,
Ivan Ivanov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Vamshi
Top achievements
Rank 1
answered on 03 Apr 2012, 07:50 AM
Hi Ivan, I have done that, binding the SelectedValue during run time after the ItemsSource is set. That doesn't help. I forgot but in a particular sequence of steps it does't even populate the ComboBoxColumn when edited. Can you please work with my sample project and give me a solution? I can't afford to lose time going back and forth doing a trial and error method. No offense but at the rate of one reply per day from you guys I am not making any progress. Thanks.
0
Dimitrina
Telerik team
answered on 03 Apr 2012, 04:22 PM
Hi,

 We have managed to find why the column is empty. As it comes out the properties that you have specified for the DataMemberBinding and for the SelectedValueMemberPath are with different types. The first one is of type long and the other is of type int. They should both be of the same type.

We have changed your project and now the value is shown fine. Please check the attached project.

Greetings,
Didie
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
Vamshi
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Vamshi
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or