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

GridView Bug? CurrentItem Changing RejectChanges

4 Answers 60 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 04 Aug 2010, 02:46 AM
System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Windows.Controls.GridView.GridViewCell.OnMouseLeftButtonDown(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonDown(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

I get the above message when I:

-I have a GridView databound to a DomainDataSource
-I make some changes to CurrentItem (through some other bound controls)
-I then try to select a different item (which triggers the DomainDataSource_DataView_CurrentChanging event where I do the following:


void cashSale_DataView_CurrentChanging(object sender, CurrentChangingEventArgs e) {
    if (IgnoreCurrent_Changing) return;
     

    DomainDataSource domainDataSource = cashSale_DomainDataSource;
    if (domainDataSource.HasChanges) {
        if (ViewBase.CheckChanges(domainDataSource)) {
            domainDataSource.RejectChanges();
        } else { e.Cancel = true; }
    }
}
(TheIgnoreCurrent_Changing is false in this case, so it does not return early)

-And clicking Ok (RejectChanges()) Causes the above error

---Also Clicking cancel performs -in the domain data source- the expected behavior of preventing the current item from changing, but the gridview has the issue of not recognizing that the change was canceled as posted here:
http://www.telerik.com/community/forums/silverlight/gridview/can-you-cancel-a-row-change.aspx





(So in short, by changing the collection, during a change, it is causing the above error)
Is there some way I can resolve this? (It performs the expected function of rejecting the changes, however, it brings up that error)

4 Answers, 1 is accepted

Sort by
0
Accepted
Nedyalko Nikolov
Telerik team
answered on 05 Aug 2010, 04:40 PM
Hello Alexander Sun,

Since I cannot simulate your issues, I've prepared a sample project. Could you please try to reproduce the problem and let me know what to do in order to get error message on my side?

P.S. To run the example you will need Northwind database and SQL Server express edition (for other instances of SQL server you have to edit web.config file).

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
Alex
Top achievements
Rank 1
answered on 09 Aug 2010, 02:06 AM
I believe this may have been an issue from an older telerik version
(As I'm running... 2010.1.603.1040) and if I use the namespace
                 xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
                
it wont work and I get the above bug, but if I use xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" it seems to work fine.
0
madladuk
Top achievements
Rank 2
answered on 24 Sep 2010, 09:42 AM
I have the same problem, I have my details control and my gridview control [both in seperate usercontrols]. In the detail control I do some validation check and if the details are not correct I call e.Cancel = true, however the highlighted row on the gridview moves to the record the user selected and does not stay where it should.
Thanks
P
0
Nedyalko Nikolov
Telerik team
answered on 28 Sep 2010, 08:40 AM
Hello madladuk,

Generally if you want to force user to enter correct data you have to use RowValidating or RowValidated events. I cannot make any guess where do you call e.Cancel = true. Could you provide me with some more information about your scenario?
Thank you in advance.

Best wishes,
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
Tags
GridView
Asked by
Alex
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Alex
Top achievements
Rank 1
madladuk
Top achievements
Rank 2
Share this question
or