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

Drag and Drop for dynamically created RadGrids

2 Answers 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 22 Mar 2012, 01:21 PM
Hello,

I currently have RadGrids that I am creating dynamically in Page Load that are embedded in PanelBar Items.  The grids create fine and render on the page.  They have the initial appearance of drag and drop, but when the row is released into the new grid, the routine tied to the RowDrop event (GridRowDrop) does not fire and the Page appears to do a PostBack.  I believe this has to do with something with AJAX settings, but not certain.

Here is a snippet from the code-behind:

Dim SectionGrid As New RadGrid()
 
 With SectionGrid
     .DataSource = GetData(FCTN_TYPE_CD, CALLING_AGENT)
     With .MasterTableView
         .NoMasterRecordsText = "No associates assigned"
         .Columns.Add(New GridDragDropColumn)
     End With
     .Rebind()
 End With
 
 ' Set each grid's properties.
 With SectionGrid
     .ID = "SectionGrid_" & FCTN_TYPE_CD
     .AllowSorting = True
     .Width = Unit.Percentage(99)
     .AutoGenerateColumns = False
     .ShowHeader = False
     .AllowMultiRowSelection = True
     .CssClass = "BottomCorners"
     .Attributes.Add("style", "border:none;")
     With .ClientSettings
         .AllowRowsDragDrop = True
         .Selecting.EnableDragToSelectRows = False
         .Selecting.AllowRowSelect = True
         .ClientEvents.OnRowDropping = "onRowDropping"
         .EnablePostBackOnRowClick = False
     End With
 End With
 
 With SectionGrid.MasterTableView
     .Width = Unit.Percentage(100)
     .DataKeyNames = New String() {"LDAP"}
     .GetColumn("LDAP").Visible = False
 End With
 
 AssignedGrid.Controls.Add(SectionGrid)
 With PanelItem
     .Items.Add(AssignedGrid)
     .Expanded = True
 End With
 
 If SectionGrid.Items.Count = 0 Then PanelItem.Expanded = False
 
 AddHandler SectionGrid.RowDrop, AddressOf GridRowDrop
 AddHandler SectionGrid.NeedDataSource, AddressOf GridNeedDataSource

Any help is appreciated.

regards,

Steve

2 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 26 Mar 2012, 02:27 PM
Steve:

I've seen this type of behavior before where the dropped row does not bind to the target RadGrid. It is usually caused when there's an error in the updating of the target grid's datasource. Try disabling the ajax functionality, which should help you to display the real error.

And, I want to be sure that you're using advanced data binding for the target grid, which is required.

Hope this helps!
0
Steve
Top achievements
Rank 1
answered on 28 Mar 2012, 04:43 PM
I was using simple binding.  Changing this to advanced binding and dynamically adding the ajax seemed to correct the issue.  Thanks for the help.
Tags
Grid
Asked by
Steve
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Steve
Top achievements
Rank 1
Share this question
or