NullReferenceException by RadGridView.LoadLayout

0 Answers 34 Views
GridView
Serhii
Top achievements
Rank 1
Serhii asked on 03 May 2024, 08:31 AM | edited on 03 May 2024, 08:45 AM

My current version is 2024.1.312.40

I tried to load a layout (xml file) saved in a previous version RadGridView and get an error that I cannot intercept. In which way I can either catch this exception or disable their occurrence for the user?

The exception occurs in the method: rdgvMain.LoadLayout(reader) and try is not working;

strLayout, reader, stream are not empty

 

 try
            {
                using (var stream = new StringReader(strLayout))
                {
                    var reader = XmlReader.Create(stream);

                    rdgvMain.LoadLayout();

                    stream.Close();
                    reader.Close();
                }
            }
            catch (Exception ex)
            {
                AddInfo(ex.Message);
            }

 

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.WinControls.UI.GridRowBehavior.OnMouseMove(MouseEventArgs e)
   at Telerik.WinControls.UI.BaseGridBehavior.OnMouseMove(MouseEventArgs e)
   at Telerik.WinControls.UI.RadGridView.OnMouseMove(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at Telerik.WinControls.RadControl.WndProc(Message& m)
   at Telerik.WinControls.UI.RadGridView.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

 

Thanks,

Serhii
Top achievements
Rank 1
commented on 03 May 2024, 09:11 AM

I found how to fix it, you need to subscribe to the event DataError
Dinko | Tech Support Engineer
Telerik team
commented on 03 May 2024, 01:55 PM

I am happy to hear that you have found a solution for your scenario. If you have any other questions feel free to open new thread and we will be happy help.

No answers yet. Maybe you can help?

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