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.
Syncfusion Feedback

Setup Lookup column

Thread ID:

Created:

Updated:

Platform:

Replies:

56430 Feb 14,2007 10:08 PM UTC Feb 20,2007 02:50 PM UTC Windows Forms 7
loading
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?
Thanks,


Lan





Temp8.zip

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
td.Relations.Add(rd);
td.Columns.LoadDefault();

Please refer to modified sample for implementation.
Temp8.zip

Best regards,
Haneef

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:
http://www.syncfusion.com/support/forums/message.aspx?&MessageID=55635

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


Lan



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.

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

Here is a sample.
Temp8Modified.zip

Best regards,
Haneef

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

Hi,
I got more question.
In your modified sample:
GGC_SummaryRowExport_2605fc15

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?

Lan

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.
GGC_SummaryRowExportModified.zip

Best regards,
Haneef

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

Hi,
Thanks for help.
It works for me now.

Lan

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.

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

;