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

Entered values are not saved when tabbing through cells

2 Answers 88 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 13 Jul 2010, 03:28 PM

Hello,

I have a RIA domain service object model , which basically have two classes a profile and a template. A profile could contain collection of templates. And these collection are set an Itemsource of the grids.

A profileGrid ItemSource set to profile collection, and when selection changes on the profile grid. I cast the selected Item to profile and then set the TemplateGrid itemsource to profile.Templates.

Ex.

private void _gridViewProfile_SelectionChanged(object sender, SelectionChangeEventArgs e)

{

ResourcingTemplateProfile profile = _gridViewProfile.SelectedItem as ResourcingTemplateProfile;

gridViewResourcingTemplate.ItemsSource = profile.ResourcingTemplates

}

 

Now the issue is when Tabbing through TemplateGrid cell and changing value in cell, the values get saves fine to the database; However, if I were to changes the profile selection lets to profile1 and then change back to the profile where I had made changes lets profile2, it would show the old value. If I refresh the browser then new would show up which essentially was saved.  On the other hand, if I don’t tab through and just hit enters then the value is save file, and is persisted between profile selection changes.  All of the saving is happening in the CellEditEnded event of the grid.

 

Could this be possible that grid is caching old binding? If it is then what would be the work around? We really need a tabbing feature to work.

 

Grid setup:

<telerik:RadGridView x:Name="_gridViewResourcingTemplate" Grid.Row="2" CanUserFreezeColumns="True"

                                                               ShowGroupPanel="True" AutoGenerateColumns="False"                                                               SelectionChanged="_gridViewResourcingTemplate_SelectionChanged"

                                                               CellEditEnded="_gridViewResourcingTemplate_CellEditEnded"

                                                               BeginningEdit="_gridViewResourcingTemplate_BeginningEdit"

                                                               RowLoaded="_gridViewResourcingTemplate_RowLoaded"

                                                               CellValidating="_gridViewResourcingTemplate_CellValidating"

                                                               VerticalAlignment="Stretch" IsFilteringAllowed="True"

                                                               AutoExpandGroups="True" FrozenColumnCount="1" SelectionMode="Extended">

 

 

2 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 16 Jul 2010, 01:48 PM
Hi Amit,

Without a sample application which I can debug on my side, I cannot resolve the problem.
However you can try something that will make TAB to behave like Enter (CommitEdit and Move current cell to the TAB next position). Take a look at this blog post and in the case when key is TAB and RadGridView.CurrentCell.IsInEditMode is true add RadGridViewCommands.CommitEdit to commandsToExecute list.

public override IEnumerable<ICommand> ProvideCommandsForKey(Key key)
{
    List<ICommand> commandsToExecute = base.ProvideCommandsForKey(key).ToList();
    if (key == Key.Tab && parentGrid.CurrentCell.IsInEditMode)
    {
        commandsToExecute.Insert(RadGridViewCommands.CommitEdit, 0);
    }
    return commandsToExecute;
}

Let me know if this doesn't help.

Regards,
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Amit Patel
Top achievements
Rank 1
answered on 20 Jul 2010, 01:59 PM
Hi Nedyalko,
I tried the solution, and it seems to be working.
Thanks
Amit
Tags
GridView
Asked by
Amit
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Amit Patel
Top achievements
Rank 1
Share this question
or