This question is locked. New answers and comments are not allowed.
Hi @
I am using Telerik RadGridView in which I have a drop down in side CellEditTemplate and a TextBlock inside DataTemplate of CellTemplate.
When I change the value in Dropdown, it should be reflected back to the Text of Textblock. But it is not happening in my case.
Following is the code to reproduce the problem I am facing.
Please let me to solve the problem.
Thanks in advance
Kalyan Gupta
I am using Telerik RadGridView in which I have a drop down in side CellEditTemplate and a TextBlock inside DataTemplate of CellTemplate.
When I change the value in Dropdown, it should be reflected back to the Text of Textblock. But it is not happening in my case.
Following is the code to reproduce the problem I am facing.
public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); radGridView1.ItemsSource = this.BindDataGrid(); } private void radGridView1_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e) { if (e.EditOperationType == GridViewEditOperationType.Insert) { ((ComboItemsCollections)(((sender as RadGridView).CurrentCell as GridViewCell).ParentRow.DataContext)).IsRowModified = "INSERT"; } else { if ((sender as RadGridView).CurrentCell != null && !((ComboItemsCollections)(((sender as RadGridView).CurrentCell as GridViewCell).ParentRow.DataContext)).IsRowModified.ToString().Equals("INSERT")) ((ComboItemsCollections)(((sender as RadGridView).CurrentCell as GridViewCell).ParentRow.DataContext)).IsRowModified = "UPDATE"; } } /// <summary> /// /// </summary> /// <param name="pstrSelectedProgram"></param> private List<ComboItemsCollections> BindDataGrid() { List<ComboItemsCollections> llstCmbItemColl; ComboItemsCollections lobjCmbItemColl; llstCmbItemColl = new List<ComboItemsCollections>(); try { for (int i = 0; i < 10; i++) { lobjCmbItemColl = new ComboItemsCollections(); lobjCmbItemColl.ComboboxColumn = "Comboitem 1"; llstCmbItemColl.Add(lobjCmbItemColl); } } catch (Exception ex) { } return llstCmbItemColl; } } public class ComboItemsCollections { List<InnerComboItems> _lstInnerComboItems; public ComboItemsCollections() { } public InnerComboItems[] InnerComboItemsCollection { get { _lstInnerComboItems = new List<InnerComboItems>(); InnerComboItems obj; for (int i = 0; i < 10; i++) { obj = new InnerComboItems(); obj.ComboItem = "Comboitem " + (i + 1).ToString(); _lstInnerComboItems.Add(obj); } return _lstInnerComboItems.ToArray(); } } public string IsRowModified { get; set; } public string ComboboxColumn { get; set; } } public class InnerComboItems { string pstrComboItem; public string ComboItem { get { return pstrComboItem; } set { pstrComboItem = value; } } public InnerComboItems() { pstrComboItem = ""; } }<Grid x:Name="LayoutRoot" Background="White"> <telerik:RadGridView FrozenColumnCount="5" FontFamily="Arial" AutoGenerateColumns="False" HorizontalAlignment="Left" Name="radGridView1" VerticalAlignment="Top" Height="380" Margin="10,10,10,0" RowEditEnded="radGridView1_RowEditEnded" CanUserDeleteRows="True"> <telerik:RadGridView.Columns> <telerik:GridViewDataColumn Header="Combobox Column" > <telerik:GridViewDataColumn.CellTemplate> <DataTemplate> <Grid> <TextBlock Name="txtComboText" Text="{Binding ComboboxColumn}" /> </Grid> </DataTemplate> </telerik:GridViewDataColumn.CellTemplate> <telerik:GridViewDataColumn.CellEditTemplate> <DataTemplate> <ComboBox ItemsSource="{Binding InnerComboItemsCollection}" SelectedItem="{Binding ComboboxColumn}" DisplayMemberPath="ComboItem"> </ComboBox> </DataTemplate> </telerik:GridViewDataColumn.CellEditTemplate> </telerik:GridViewDataColumn> </telerik:RadGridView.Columns> </telerik:RadGridView> </Grid>Please let me to solve the problem.
Thanks in advance
Kalyan Gupta