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

Combobox Column Databinding Problem

2 Answers 78 Views
GridView
This is a migrated thread and some comments may be shown as answers.
amirnet
Top achievements
Rank 1
amirnet asked on 21 Oct 2009, 12:16 PM
Hi i have a grid containg a combobox column,i had a few research for databinding in a template,but i can see databounded objects in my column ,whats wrong

Gridview is databound manually in runtime from EntityFramework,i cant see data aboute row groups in gridview column

//Gridview
<telerik:GridViewColumn  CellTemplate="{DynamicResource Cell_RouteGroup}" Header="Group" Width="180" DataContext="{Binding RouteGroupDataSource}"></telerik:GridViewDataColumn>

//Template
    <UserControl.Resources>
        <DataTemplate x:Key="Cell_RouteGroup">
            <telerik:RadComboBox Height="29"  Width="118" Foreground="Black"  DisplayMemberPath="GroupName" SelectedValuePath="RouteGroupID" ItemSource={Binding RouteGroupSource}  SelectedValue="{Binding RouteGroupID}" />
        </DataTemplate>
    </UserControl.Resources>

//C#
 public IOrderedQueryable<Routes_Groups> RouteGroupDataSource
        {
            get { return Loader.TEX.Routes_Groups.OrderBy(p => p.GroupName); }
        }


2 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 23 Oct 2009, 08:32 AM
Hello amirnet,

In your code I see that you are defining the ComboBox in a template explicitly.  There is no need to do this. RadGridView provides a specialized column - the GridViewComboBox column. It would create the combobox and set bindings for you. You just need to define such column and set a few properties.
The approach is described in details in  this article.

In case you have further troubles , just send me your project and I will gladly modify it to fix the issue.

*In order to attach the project files you will need to open a support ticket.

Sincerely yours,
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
amirnet
Top achievements
Rank 1
answered on 27 Oct 2009, 10:30 AM
thanks for help ,it helped me very much
Tags
GridView
Asked by
amirnet
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
amirnet
Top achievements
Rank 1
Share this question
or