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

Column Binding Problem

5 Answers 168 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Celso
Top achievements
Rank 1
Celso asked on 12 Dec 2008, 09:05 PM
Hi,

I have two set of objects, that are related in the following way:

public class MyObject1 
   private MyObject2 _o2 = new MyObject2() { Address = "CR" }; 
   public MyObject2 O2 
   { 
            get 
            { 
                return _o2; 
            } 
            set 
            { 
                _o2 = value; 
            } 
        } 
 
        public string Name 
        { 
            get
            set
        } 
    } 
 
    public class MyObject2 
    { 
        public string Address 
        { 
            get
            set
        } 
    } 
 


And I am binding the following set of properties on the grid:

<telerik:RadGridView Name="radGridView1" ItemsSource="{Binding}" AutoGenerateColumns="False"
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn UniqueName="Name" IsGroupable="True" IsReadOnly="False" IsFilterable="True" HeaderText="Name" DataMemberBinding="{Binding Name}" /> 
                <telerik:GridViewDataColumn UniqueName="Address" IsGroupable="True" IsReadOnly="False" IsFilterable="True" DataMemberBinding="{Binding O2.Address}" HeaderText="Address" /> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 

But after doing this binding the column binded to O2.Addres canĀ“t be modified, grouped, filter. So I will like to know if this can be performed in some way.

Thanks







5 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar Dobrev
Telerik team
answered on 15 Dec 2008, 12:41 PM
Hello Celso,

You have stumbled upon a problem that appears to be a glitch in the control. We have logged it in our To-Do list and we will start looking into it right away.

As a workaround I suggest that you use the DataMemberPath instead of the DataMemeberBinding by simply setting the property path for the second column. You will also need to specify the data-type of the second column and make the binding mode of the first column two-way if you need editing:


<telerik:RadGridView Name="radGridView1" ItemsSource="{Binding}" AutoGenerateColumns="False"
    <telerik:RadGridView.Columns> 
        <telerik:GridViewDataColumn UniqueName="Name" HeaderText="Name" DataMemberBinding="{Binding Name, Mode=TwoWay}" /> 
        <telerik:GridViewDataColumn UniqueName="Address" DataMemberPath="O2.Address" DataType="{x:Type system:String}" HeaderText="Address" /> 
    </telerik:RadGridView.Columns> 
</telerik:RadGridView> 

If you encounter other issues, we will greatly appreciate your feedback.

Your Telerik points have been updated for your involvement.

Regards,
Dimitar Dobrev,
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Sebastian Talamoni
Top achievements
Rank 1
answered on 18 Feb 2009, 07:49 PM
Exactly.  I am experiencing exactly the same problem.

Normally in our Architecture we have View objects and nested we have the real domain objects which are normally the context for the databinding..

Using your trick/workaround works fine.
 The only disadvantage seems to be that the datatype is "required". 

Are there any other disadvantage of using DataMemberPath ?
Is this problem already fixed for next release?

0
Milan
Telerik team
answered on 20 Feb 2009, 10:35 AM
Hi Sebastian Talamoni,

The issues will be resolved in the upcoming release.

Regards,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Dogu
Top achievements
Rank 1
answered on 06 Mar 2009, 08:34 AM

if you use UniqueName for a column. It works fine with both DataMemberPath and DataMemeberBinding.

dogu tumerdem

0
Celso
Top achievements
Rank 1
answered on 06 Mar 2009, 01:44 PM
Hi Dimitar Dobrev

Thanks for your help!... I will be awaiting for next releases

Regards,

Celso
Tags
GridView
Asked by
Celso
Top achievements
Rank 1
Answers by
Dimitar Dobrev
Telerik team
Sebastian Talamoni
Top achievements
Rank 1
Milan
Telerik team
Dogu
Top achievements
Rank 1
Celso
Top achievements
Rank 1
Share this question
or