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

RadGridView adding GridViewComboBox

1 Answer 70 Views
GridView
This is a migrated thread and some comments may be shown as answers.
bud
Top achievements
Rank 1
bud asked on 11 Mar 2015, 06:21 PM
      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:RadGridView.Columns>

                <telerik:GridViewComboBoxColumn UniqueName="B" DisplayMemberPath="Name" SelectedValueMemberPath="ID" DataMemberBinding="{Binding Option}" />
            </telerik:RadGridView.Columns>
        </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







1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 16 Mar 2015, 04:48 PM
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,
Stefan
Telerik
 

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.

 
Tags
GridView
Asked by
bud
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or