Hello,
I have a radgridview that populates with data from a database. I also have three empty columns for entering in information. The problem I am having is that whenever I enter in information into the columns and click out of the cell, the information disappears and the gridview doesn't update accordingly. I think I have my code set up right, so I'm unsure of what my issue could be. Here is my code for my xaml:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:DeductionInfoBSAP" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="DeductionInfoBSAP.MainWindow" mc:Ignorable="d" Title="MainWindow" Height="482" Width="764.5" Loaded="Window_Loaded"> <Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Telerik.Windows.Themes.Office2016;component/Themes/System.Windows.xaml"/> <ResourceDictionary Source="/Telerik.Windows.Themes.Office2016;component/Themes/Telerik.Windows.Controls.xaml"/> <ResourceDictionary Source="/Telerik.Windows.Themes.Office2016;component/Themes/Telerik.Windows.Controls.Input.xaml"/> <ResourceDictionary Source="/Telerik.Windows.Themes.Office2016;component/Themes/Telerik.Windows.Controls.GridView.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources> <Grid> <Grid.Resources> <local:ViewModel x:Key="ViewModel"/> </Grid.Resources> <telerik:RadGridView x:Name="gridView" Margin="0,0,0,-454" ScrollViewer.HorizontalScrollBarVisibility="Visible" IsReadOnly="False" AlternationCount="-1" IsManipulationEnabled="True" SelectionChanged="gridView_SelectionChanged" CellEditEnded="gridView_CellEditEnded" CurrentCellChanged="gridView_CurrentCellChanged" /> </Grid></Window>
Here is my code for the gridView_CellEditEnded event which attempts to commit any edits made to those cells:
bool handle = true;
private void gridView_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
{
if(e.EditAction == GridViewEditAction.Commit && handle)
{
handle = false;
gridView.Items.EditItem(this.gridView.CurrentItem);
gridView.Items.CommitEdit();
handle = true;
}
}
If anyone is able to help me understand what I'm doing wrong, it would be greatly appreciated. I've read every forum and thread I could on this and could not fix my issue.