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

Row edit Status

7 Answers 68 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joe Bohen
Top achievements
Rank 1
Joe Bohen asked on 02 Sep 2009, 12:08 PM

Hi

I am using an example you provided in a previous reply to implement drag and drop from a radgridview. When using the mouse down event to pass row information into an array if the row being dragged is being edited the application crashes completely. How do I handle this (test for the row edit state) to prevent the crash?

Regards

Joe

Private Sub RadGridView1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles SubContractgrd.MouseDown

        Try

                downpoint = e.Location

                rowtodrag = GetRowAtPoint(Me.SubContractgrd, e.Location)

                ContArray(0, 0) = (rowtodrag.Cells(0).Value)

                ContArray(0, 1) = (rowtodrag.Cells(1).Value)

                ContArray(0, 2) = (rowtodrag.Cells(2).Value)

                If Not IsNothing(rowtodrag.Cells("Text").Value) Then

                    ContArray(0, 2) = Replace(StrConv(rowtodrag.Cells("Text").Value, VbStrConv.Uppercase), " ", "")

                Else

                    ContArray(0, 2) = (rowtodrag.Cells(1).Value)

                End If

 

                If Not IsNothing(rowtodrag.Cells("D").Value) Then

                    ContArray(0, 3) = "SD"

                End If

                If Not IsNothing(rowtodrag.Cells("V").Value) Then

                    If Not IsNothing(ContArray(0, 3)) Then

                        ContArray(0, 3) = "SDV"

                    Else

                        ContArray(0, 3) = "SD"

                        End

                    End If

                End If

            End If

        Catch ex As Exception

            If Err.Number = 91 Then

                Err.Clear()

                Exit Sub

            Else

                MsgBox(Err.Description & Err.Number)

            End If

 

        End Try

    End Sub

7 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 02 Sep 2009, 02:07 PM
Hello Joe Bohen,

You can check IsInEditMode property to determine whether RadGridView is in edit mode. Use the EndEdit method to finish the editing process. I hope this helps. If you need further assistance, I will be glad to help.

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Joe Bohen
Top achievements
Rank 1
answered on 03 Sep 2009, 07:06 AM

Hi Jack

Thanks for the quick reply; I have tried to trap the issue with the addition of the code lines:

If Me.subcontractgrd.IsIneditMode  then

Me.subcontractgrd.EndEdit

End if

But I am still getting an issue the application falls over without reporting any problem in the catch block but the line below is produce in the immediate window!

A first chance exception of type 'System.NullReferenceException' occurred in MyProject.exe

This would suggest that the problem does not lie with the editor state but is being caused elsewhere. My grid is data bound and I am adding three additional columns to the grid at runtime, two checkbox columns and a textbox column, the user checks one of the columns and adds additional information onto the textbox. Could this be causing the issue? Should I load the grid rows using a disconnected data source?

Regards

Joe

0
Jack
Telerik team
answered on 03 Sep 2009, 08:15 AM
Hello Joe Bohen,

The data source shouldn't cause this issue. Please, could you send me your application and I will investigate this case in detail. I am looking forward to your reply.

All the best,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Joe Bohen
Top achievements
Rank 1
answered on 03 Sep 2009, 09:48 AM
Hi Jack

I have uploaded a project file to support ticket number 240008.

Regards
Joe
0
Jack
Telerik team
answered on 03 Sep 2009, 11:08 AM
Thank you Joe, please find the answer to your question in your ticket.

Best wishes,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Joe Bohen
Top achievements
Rank 1
answered on 04 Sep 2009, 07:23 AM

Hi Jack

Thanks for your code but I still have a problem which seems quite strange if the first of the checkbox columns is clicked then the application still falls over but if the second of the checkboxes is clicked first there is no problem even when the second checkbox is clicked and then the first is clicked. Why should the application remain stable and continue to work if this procedure is followed but fails if the first of the checkboxes is clicked first. I hope you can follow what I am saying.

Regards

Joe

0
Jack
Telerik team
answered on 04 Sep 2009, 01:48 PM
Hi Joe, you can find the answer to this question in your support ticket (ID 240008). If you have more questions, don't hesitate to ask.

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Joe Bohen
Top achievements
Rank 1
Answers by
Jack
Telerik team
Joe Bohen
Top achievements
Rank 1
Share this question
or