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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

MappingName in GridDataBoundGrid

Thread ID:





70943 Jan 9,2008 04:46 PM UTC Jan 9,2008 05:00 PM UTC WinForms 1
Tags: GridControl
Asked On January 9, 2008 04:46 PM UTC

How can I create two gridBoundColumns that will have the same mapping name of the dataSource. I mean that I want to have two gridBoundColumns that will display the same data from a dataTable (and after that to configure for each one of them other rendered). The problem is that I can't configure more than one column with the same mappingName.

Haw can I do this ???


haneefm [Syncfusion]
Replied On January 9, 2008 05:00 PM UTC

Hi Yoni,

You cannot have two columns with the same mapping name. But one way you can do this by adding an unbound column in a grid.

To do this, where you want the second column, add a GridBoundColumn with some unique mapping name, say "UProduct". (At this point, this will just display an empty column in that position in the grid.) To populate this column, add a grid.model.QueryCellInfo event handler. In the handler have code like this.

int colIndex = grid.Binder.NameToColIndex("UProduct");
if(colIndex == e.ColIndex && e.RowIndex > 0 && e.RowIndex < grid.Model.RowCount)
colIndex = grid.Binder.NameToColIndex("OrderID");
e.Style.CellValue = grid[e.RowIndex, colIndex].CellValue;

Please refer to the attached sample for implementation and let me know if this helps.

This should put th evalues from the real OrderID column into the "UProduct" column. In the code above the "&& e.RowIndex < grid.Model.RowCount" check is only needed if you have an AddNew row at the bottom of the grid.

Best regards,


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon