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

[Solved] Editing RadGridView Hierarchical Data

1 Answer 135 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrew
Top achievements
Rank 1
Andrew asked on 07 Apr 2009, 06:34 AM
Hi,

I am looking at editing cells within a RadGridView thats ItemsSource is set to an ObservableCollection, which has Data Objects as some properties. Then on the GridView, these are displayed such as UniqueName="Boundary.Target"

Whenever I double click to edit a cell, the Silverlight control fails, and I get the error

System.NullReferenceException: Object reference not set to an instance of an object.


I saw something mentioned here
http://blog.falafel.com/2009/02/11/BindingRadGridViewControlsTogetherUsingCellElements.aspx

"Of course, this version is read-only, and using this method for editing would get tricky since the virtualized grid re-uses its cells after they are created"

I noticed that the examples supplied with the Silverlight controls in GridView, such as Custom Hierarchy, Self Reference, were all Read-Only


Is there a way to edit cells on GridViews that have hierarchical data?



1 Answer, 1 is accepted

Sort by
0
Andrew
Top achievements
Rank 1
answered on 07 Apr 2009, 11:11 PM
I found a solution by adding DataType = (typeof(...)) to the data column

TestDataGrid.Columns.Add(new GridViewDataColumn() { DataType = (typeof(string)), HeaderText = "Abbr", UniqueName = "Test.Abrr"});

Now I can edit without the application crashing



Tags
GridView
Asked by
Andrew
Top achievements
Rank 1
Answers by
Andrew
Top achievements
Rank 1
Share this question
or