We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Grid Column Drag and Drop

Thread ID:

Created:

Updated:

Platform:

Replies:

66951 Aug 6,2007 09:53 AM Aug 10,2007 10:15 AM Windows Forms 6
loading
Tags: GridControl
Sugandha Aggarwal
Asked On August 6, 2007 09:53 AM

Hi,

I have 2 Grids on one of my windows. The top grid does some custom analytics on the data from the lower grid. I want to be able to drag the column from the lower grid and capture it on the another grid.

I am able to drag the range of cells from the lower grid but not able to drag the column header. And I need only the column header of the column which I am dragging to the upper Grid.

I looked into the grid samples provided by syncfusion but they all show drag and drop for the cell or range of cell values and not the column header.

Any help will be appreciated.

Regards,
Sugandha Aggarwal

haneefm [Syncfusion]
Replied On August 6, 2007 01:51 PM

Hi Sugandha,

Moving columns is support by default in a Grid. If you click a colheader to select the column, then if you mousedown on the selected column header, you can drag and drop it in another position.

If you do not see this behavior, check the AllowDragSelectedCols property to make sure it is on. Try turning on this property and enable the DragColumnHeader flag in the Controller option.

this.grid.AllowDragSelectedCols = true;
this.grid.ControllerOptions |= GridControllerOptions.DragColumnHeader;

Best regards,
Haneef

Sugandha Aggarwal
Replied On August 7, 2007 02:53 AM

Hi Haneef,

Thanks for the reply, but my problem is not dragging the column header within the same grid. I want to drag that column header to the other grid and want to capture the name at the drop on the other grid.

DragColumnHeader flag in the Controller option helps in dragging the column header but I am not able to capture it in the other grid. Please help.

Regards,
Sugandha

Sugandha Aggarwal
Replied On August 7, 2007 02:53 AM

Hi Haneef,

Thanks for the reply, but my problem is not dragging the column header within the same grid. I want to drag that column header to the other grid and want to capture the name at the drop on the other grid.

DragColumnHeader flag in the Controller option helps in dragging the column header but I am not able to capture it in the other grid. Please help.

Regards,
Sugandha

Sugandha Aggarwal
Replied On August 9, 2007 01:22 AM

Hi,

I am still waiting for some input from anybody.

Regards,
Sugandha Aggarwal

>Hi Haneef,

Thanks for the reply, but my problem is not dragging the column header within the same grid. I want to drag that column header to the other grid and want to capture the name at the drop on the other grid.

DragColumnHeader flag in the Controller option helps in dragging the column header but I am not able to capture it in the other grid. Please help.

Regards,
Sugandha

Melba Winshia [Syncfusion]
Replied On August 10, 2007 10:14 AM

Hi Sugandha,

If your intention is to drag the column from one grid to the other grid you can use OleDragDrop to move a column.

Please refer the below link which illustrates the above.

http://websamples.syncfusion.com/samples/Frid.Windows/66951/main.htm

And you can use QueryAllowDragcolumnHeader event to capture the name.

[C#]

void gridDataBoundGrid1_QueryAllowDragColumnHeader(object sender , GridQueryDragColumnHeaderEventArgs e)
{

int field = gridDataBoundGrid1.Binder.ColIndexToField(2);
string colname = gridDataBoundGrid1.Binder.InternalColumns[field].MappingName;

}

Please try this and let me know if this helps.

Thanks,
Melba


Melba Winshia [Syncfusion]
Replied On August 10, 2007 10:15 AM

Hi Sugandha,

If your intention is to drag the column from one grid to the other grid you can use OleDragDrop to move a column. And you can use DragOver event to capture the name.

[C#]

private void gridControl2_DragOver(object sender, DragEventArgs e)
{
e.Effect=DragDropEffects.Copy;
GridCurrentCell cc = this.gridControl1.CurrentCell;
int colindex = cc.ColIndex;
string column = GridRangeInfo.GetAlphaLabel(colindex);
Console.WriteLine(column);

}

Please refer the below link which illustrates the above.

http://websamples.syncfusion.com/samples/Grid.Windows/66951/main.htm

Please try this and let me know if this helps.

Thanks,
Melba


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;