GridView Bug? CurrentItem Changing RejectChanges

5 posts, 1 answers
  1. Alex
    Alex avatar
    141 posts
    Member since:
    Mar 2010

    Posted 03 Aug 2010 Link to this post

    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)
  2. Answer
    Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 05 Aug 2010 Link to this post

    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
  3. DevCraft banner
  4. Alex
    Alex avatar
    141 posts
    Member since:
    Mar 2010

    Posted 08 Aug 2010 Link to this post

    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.
  5. madladuk
    madladuk avatar
    126 posts
    Member since:
    Dec 2009

    Posted 24 Sep 2010 Link to this post

    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
  6. Nedyalko Nikolov
    Admin
    Nedyalko Nikolov avatar
    871 posts

    Posted 28 Sep 2010 Link to this post

    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
Back to Top
DevCraft banner