RadGridView adding GridViewComboBox

2 posts, 0 answers
  1. bud
    bud avatar
    1 posts
    Member since:
    Mar 2015

    Posted 11 Mar 2015 Link to this post

          public ObservableCollection<ABC_Class> Avldata = new ObservableCollection<ABC_Class>();

                 Avldata.Add(new GrpClass() { A =1, B = 1, C = 1});
                 Avldata.Add(new GrpClass() { A =2, B = 2, C = 2});
                 Avldata.Add(new GrpClass() { A =3, B = 3, C = 3});
                ((GridViewComboBoxColumn)this.ABC.Columns["B"]).ItemsSource = GetOptions();
                 this.ABC.ItemsSource = Avldata.ToList();

      <telerik:RadGridView Name="ABC"
                                 AutoGenerateColumns="True"  Grid.ColumnSpan="4"  Grid.RowSpan="3"
                                 ShowGroupPanel="False" EnableRowVirtualization="True" EnableColumnVirtualization="True"  RowIndicatorVisibility="Collapsed" Margin="10,0,0,6" CellValidating="CellValidating" AddingNewDataItem="AddingNewDataItem" RowEditEnded="RowEditEnded" DataLoaded="Dataload" KeyDown="KeyDown" CellEditEnded="CellEditEnded" RenderTransformOrigin="0.5,0.5" Grid.Row="2" BeginningEdit="BeginningEdit" RowLoaded="RowLoaded"  VerticalAlignment="Top" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False" CanUserSortGroups="False" ColumnWidth="80" KeyboardNavigation.AcceptsReturn="True" MaxColumnWidth="150" MinColumnWidth="80"  CanUserFreezeColumns="False" ContextMenuService.IsEnabled="False" IsFilteringAllowed="False" EnableLostFocusSelectedState="False" IsLocalizationLanguageRespected="False">

                    <telerik:GridViewComboBoxColumn UniqueName="B" DisplayMemberPath="Name" SelectedValueMemberPath="ID" DataMemberBinding="{Binding Option}" />
            </telerik:RadGridView>  I am trying to show combo box in Column "B" edit mode so user can select value from combo.but combo box appearing in column index "0".how to fix the problem .thanks

  2. Stefan
    Stefan avatar
    1073 posts

    Posted 16 Mar 2015 Link to this post

    Hi Bud,

    A way of reordering RadGridView columns is to set the DisplayIndex property. Since you are using the auto generating  columns functionality of RadGridView you need to subscribe to the AutoGeneratingColumn event and set the DisplayIndex within the event handler method:
    void myGrid_AutoGeneratingColumn(object sender,
        GridViewAutoGeneratingColumnEventArgs e)
        this.myComboBoxColumn.DisplayIndex = 1;

    You can also check the Reordering Columns documentation article for further reference.

    I hope that this helps.

    Best Regards,

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top