Combobox Column Databinding Problem

3 posts, 0 answers
  1. amirnet
    amirnet avatar
    5 posts
    Member since:
    Jul 2007

    Posted 21 Oct 2009 Link to this post

    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. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 23 Oct 2009 Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
  4. amirnet
    amirnet avatar
    5 posts
    Member since:
    Jul 2007

    Posted 27 Oct 2009 Link to this post

    thanks for help ,it helped me very much
Back to Top