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

Editting cells

3 Answers 88 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 28 May 2012, 01:02 PM
This is driving me nuts.
When I allow the columns to be AutoGenerated I can they can be editted, that is the original values are shown and can be modified ( and the data persists ). If I define the fields manually, as below, then the cell is blanked prior to editiing and when the cell loses focus the editted cell reverts to its original value. I'm sure that I am doing something stupid but cannot work this out.

<telerik:RadGridView
              Name="rgv1"
              RowIndicatorVisibility="Visible"
              Grid.Column="1" Grid.Row="2"
              ItemsSource="{Binding ValidUsers}"
              SelectedItem="{Binding SelectedValidUser, Mode=TwoWay}"
              IsSynchronizedWithCurrentItem="True"
              AutoGenerateColumns="False"
              EditTriggers="CellClick">
             <telerik:RadGridView.Columns>
                  <telerik:GridViewDataColumn DataMemberBinding="{Binding userPassword, Mode=TwoWay}" />
            </telerik:RadGridView.Columns>
</telerik:RadGridView>

Thanks

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 28 May 2012, 02:28 PM
Hello,

 Indeed this is strange. You have defined the column as explained in this 'Getting Started' article.
  Would you please share how is your data defined?

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Peter
Top achievements
Rank 1
answered on 28 May 2012, 03:32 PM
Hi,

The source data is held in an SQlite database and accessed through a domain model generated by Telerik Opens Access in Visual Studio 2010.

The RadGridView is bound to the ValidUsers property in the ViewModel which returns a collection of the records and is declared as

public ObservableCollection<ValidUser> ValidUsers { get; set; }

The SelectedItem of the gridview is bound to the SelectedValidUser property which is declared as
 
public ValidUser SelectedValidUser
{
 
get  return selectedValidUser; }
 
set  {
       
if (this.selectedValidUser == value) return;
       
this.selectedValidUser = value;
       
this.OnPropertyChanged("SelectedValidUser");
       }
}

This works perfectly well, and is fully tested when the columns are AutoGenerated, in fact if I allow the columns to be AutoGenerated AND I also add a defined column, the AutoGenerated works fine while the user defined column does not, this while using the same bound data source.

Thanks
0
Peter
Top achievements
Rank 1
answered on 29 May 2012, 06:57 AM
Hi,

Stupidity reigns!!

It was simply that I used the database element names as defined in the SQllite database. The Open Access Domain Model creates properties with Capitalised names, so when the columns are Autogenerated the correct feild names were automatically used. However, when setting up data columns directly in the XAML, I inadvertently used the database table field names. Changing classID to ClassID (etc) did the trick.

Thanks for  looking into it anyway, the clue was in the data as you suggested
Tags
GridView
Asked by
Peter
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Peter
Top achievements
Rank 1
Share this question
or