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

[Solved] GridViewComboBoxColumn not working with DomainDataSource

3 Answers 243 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.
Paul Brause
Top achievements
Rank 1
Paul Brause asked on 03 Dec 2009, 11:21 AM
Hello,

we are trying to implement a GridViewComboBoxColumn in a telerik RadGridView. Our Silverlight project uses RIA services (latest November BETA) to communicate with the database.

The Grid uses a DomainDataSource gridSource as data provider with RIA services in the background. The data provider for all ComboBox controls in the GridViewComboBoxColumn is another DomainDataSource comboSource. We cannot get things to work, the comboboxes are either empty or we are getting errors when starting our app.

Here is the definition of our datasources:
        <Controls:DomainDataSource x:Name="gridSource" AutoLoad="True" QueryName="GetCdArticle">  
            <Controls:DomainDataSource.DomainContext>  
                <AmaliaRIAServices:AmaliaDomainContext/>  
            </Controls:DomainDataSource.DomainContext>  
        </Controls:DomainDataSource>  
        <Controls:DomainDataSource x:Name="comboSource" AutoLoad="True" QueryName="GetCdArtGroup1">  
            <Controls:DomainDataSource.DomainContext>  
            </Controls:DomainDataSource.DomainContext>  
        </Controls:DomainDataSource>  

The table we use in gridSource references comboSource via the property cdArtGroup1.ID. This is not a simple property,
cdArtGroup1is another entity object inside our article object, from which we need the property ID. comboSource references  an articlegroup table with two properties: ID and Caption and is used to feed our comboboxes.

When we create a single RadComboBox in our form the combobox is filled and displayed correctly with ID and Caption of DomainDataSource comboSource. Here is a code that works:
<telerikInput:RadComboBox ItemsSource="comboSource" DisplayMemberPath="Caption"/> 

Our gridView generates one combobox per row and should feed the property cdArtGroup1.ID to the DataMemberBinding property of the GridComboBox which additionally sets the properties ItemssSource, DisplayMemberPath and SelectedValueMemberPath.

This is how we are generating out GridComboBoxes:
<telerik:GridViewComboBoxColumn Header="Combo" UniqueName="ComboGrp1" DataMemberBinding="{Binding ID, ElementName=cdArtGroup1}"   
    ItemsSource="comboSource" SelectedValueMemberPath="ID" DisplayMemberPath="Caption"/> 

The error message we get after starting our project is:

Unhandled Exception - Code 4004  
Category: ManagedRunTimeError  
 
Message: System.ArgumentException: Invalid property or field - "ID" for type:Char at  
Telerik.Windows.Data.Expressions.MemberAccessTokenExtensions.Create...token,Expression Instance)  
...  
...  
... 

This code and other variations of this code are not working! So it seems that we are doing something wrong in accessing the properties.

Anyone help?

3 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 03 Dec 2009, 11:35 AM
Hello Paul Brause,

If this is acceptable for you , can you please send me your project ( to be able to attach it you will need to open a support ticket) . I  will gladly modify it in order to make it  work .
In case sending your project  is not  acceptable we can try debug the problem step by step .

Best wishes,
Pavel Pavlov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
roger
Top achievements
Rank 1
answered on 11 Dec 2009, 06:58 PM
I woud be very interested to see a possible solution.

Thanks
0
roger
Top achievements
Rank 1
answered on 12 Dec 2009, 03:06 PM
Heres the error i get:
   at EstateSuiteIntranetInterface.Views.WebContentManagement.cmdTable_Click(Object sender, RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

Now i've solved this (partially) with a very very ugly workaround:

After the grid is loaded i execute this:

EntityQuery<EstateSuiteIntranetInterface.Web.WebColors> query = from c in context.GetWebColorsQuery()
select c;
LoadOperation<WebColors> loadOp = context.Load(query);

GridViewComboBoxColumn column = new GridViewComboBoxColumn();
column.Header = "Colors";
column = new GridViewComboBoxColumn();
column.ItemsSource = loadOp.Entities;
column.SelectedValueMemberPath = "id";
column.DisplayMemberPath = "name";
System.Windows.Data.Binding binding = new System.Windows.Data.Binding("fkWebColor");
column.DataMemberBinding = binding;
radGridViewWebSections.Columns.Add(column);
radGridViewWebSections.Rebind();

well... the items are bound but the current selection isn't initially displayed.. dont know why... but it's not a perfect solution.. not at all...
Tags
GridView
Asked by
Paul Brause
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
roger
Top achievements
Rank 1
Share this question
or