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

Setup Lookup column

Thread ID:





56430 Feb 14,2007 10:08 PM UTC Feb 20,2007 02:50 PM UTC WinForms 7
Tags: GridControl
Lan Mo
Asked On February 14, 2007 10:08 PM UTC

I want to setup lookup by foreign key reference
I got two project:
The SetLookup() in GGC_ForeignKeyReference.sln works, but SetLookup() in GGC_SummaryRow_Custom.sln does not work. It got error in line:
td.VisibleColumns.Insert(lookUpIndex, foreignDisplayColInMainTable);

The code SetLookup()are same in both project.

I can't figure out the reason why. Any idea?



Administrator [Syncfusion]
Replied On February 15, 2007 09:58 PM UTC

Hi Lan,

The reason is that you are modifying the column descriptor before adding the relation.( In your sample, you are setting the HeaderText of the 0th column to Identity). When the column descriptor is modified, it does not repopulate the columns after adding the relation to tabledescriptor. If you want to repopulate the column then you need to call the LoadDefault method explicitly. Here is a code snippet.

//step 5. add relation descriptor to main tabledescriptor

Please refer to modified sample for implementation.

Best regards,

Administrator [Syncfusion]
Replied On February 16, 2007 07:03 PM UTC

Hi Haneef,
Thanks for help. Now the lookup column works well.

Now I got another problem. In the sample, the button 'Button1' is to export the grid to excel.
It uses GroupingGridExcelConverterExt.cs which I got from my previous post:

If you click the button1 to export Grid to excel, It will get error now. Any idea?


Administrator [Syncfusion]
Replied On February 16, 2007 09:04 PM UTC

Hi Lan,

I have modified the ExportColumnHeader method in GroupingGridExcelConverterExt.cs file. Please try the attached sample and let me know if this helps.

if( arrColumns.Contains(column.Name))
range.Text = arrColumns[column.Name].HeaderText;
range.Text = column.Name;

Here is a sample.

Best regards,

Administrator [Syncfusion]
Replied On February 16, 2007 10:02 PM UTC

Thanks for help. It works well for me now.

Administrator [Syncfusion]
Replied On February 19, 2007 06:03 PM UTC

I got more question.
In your modified sample:

If you group by state or country, then click 'button1' to export to excel. You will get error in line:
private int ExportRecordRow( RecordRow row, IWorksheet sheet, int index, ConverterOptions options
, int iIndexInGroup, int iGroupLevel, out int iSkipRecordRows )

GridTableControl tc = engine.GroupingControl.GetTableControl(table.Name);
GridTableCellStyleInfo cellStyle = t.GetTableCellStyle(row, column.Name);


Any idea?


Administrator [Syncfusion]
Replied On February 20, 2007 12:09 AM UTC

Hi Lan,

Instead of using the GetTableCellStyleInfo method, try using the TableModel indexer to get the cell style in a grid. Here is a code snippet.

GridTableControl tc = engine.GroupingControl.GetTableControl(table.Name);
///GridTableCellStyleInfo cellStyle = t.GetTableCellStyle(row, column.Name);
//Use the below method..
GridTableCellStyleInfo cellStyle = t.TableModel[RowIndex,ColIndex] ;

Please refer to the attached sample for more information.

Best regards,

Administrator [Syncfusion]
Replied On February 20, 2007 02:50 PM UTC

Thanks for help.
It works for me now.



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