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

Rowreordering then why source is null ?

2 Answers 26 Views
GridView
This is a migrated thread and some comments may be shown as answers.
JongIn
Top achievements
Rank 2
JongIn asked on 09 Mar 2011, 10:39 AM
Hi,

I am trying to create a grid with rowreordering, but could not run because of "source is null".
Is there a specific collection that I can use for that?

Also, I use DomainDataServiice for ItemsSource.

else if (e.Options.Status == DragStatus.DragComplete)
           {
               IList source = gridView.ItemsSource as IList;
               foreach (object draggedItem in draggedItems)
               {
                   source.Remove(draggedItem);                    
               }
           }

 


Thanks,
Greg

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvyatko
Telerik team
answered on 11 Mar 2011, 10:47 AM
Hi JongIn,

the reason for that is the fact that DomainDataSourceView does not inplement IList. This means that you cannot change row order since the server will return the items in the same order (since the entities are recognized by their primary key, which is immutable).

What you can do is add new column/property in our data model that represent the item order (e.g. Order) and when items are reordered on the silverlight client only to update these properties values of the dragged/dropped objects and submit changes. After that the "GetYourEntities()" method should return the data ordered by this property.

Let me know if you have any further questions.

Best wishes,
Tsvyatko
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
JongIn
Top achievements
Rank 2
answered on 14 Mar 2011, 06:11 AM
Hi, Tsvyatko

Thanks for your answer..^^

Regards
Greg
Tags
GridView
Asked by
JongIn
Top achievements
Rank 2
Answers by
Tsvyatko
Telerik team
JongIn
Top achievements
Rank 2
Share this question
or