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. Image for the cookie policy date
close icon

How to make two columns''s data display in one GridColumnDescriptor

How to make two columns's data display in one GridColumnDescriptor ,I used MappingName="FirstName LastName" but no use.


2 Replies

HA haneefm Syncfusion Team January 4, 2008 07:53 PM UTC

Hi Strife,

You cannot have two columns 's data display in one GridColumnDescriptor .

To do this, you need to add a unbound column with some unique mapping name, say "ID-Name". (At this point, this will just display an empty column in that position in the grid.) To populate this column, add a grid.QueryCellValue event handler. In the handler have code like this.

int RecordIndex =this.gridGroupingControl1.Table.PrimaryKeySortedRecords.IndexOf(e.Record);
if (e.Field.Name == "ID_Name" && RecordIndex >= 0)
{
string s = e.Record.GetValue("Id").ToString() + "-" + e.Record.GetValue("Name").ToString();
e.Value= s;
}

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

Best regards,
Haneef



SE Sean January 7, 2008 07:19 AM UTC

Hi:
thanks it helps a lot.


Loader.
Live Chat Icon For mobile
Up arrow icon