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.

ExcelFilter Relation nor working

Thread ID:

Created:

Updated:

Platform:

Replies:

128335 Jan 15,2017 12:15 PM Jan 16,2017 01:25 AM Windows Forms 1
loading
Tags: GridGroupingControl
Thomas
Asked On January 15, 2017 12:15 PM

Hello,

I need a little bit help. I use Entity Framework.
I have a table with ORDERS and inside a column with a UserID. I load the table with:

using (DiBeMaEntities db = new DiBeMaEntities())
            {
                orderBindingSource.DataSource = db.order.ToList();
                userBindingSource.DataSource = db.users.toList();
            }

I have a second table with users (UserId and Name) and I would replace the UserId with the Name:

gridGroupingControl1.TableDescriptor.Columns["User"].Appearance.AnyRecordFieldCell.CellType = "GridListControl";

        private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
        {
            if (e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
            {
                if (e.TableCellIdentity.Column != null && (e.TableCellIdentity.Column.MappingName == "CreateUser" || e.TableCellIdentity.Column.MappingName == "EditUser"))
                {
                    e.Style.DataSource = userBindingSource.DataSource;
                    e.Style.DisplayMember = "Lastname";
                    e.Style.ValueMember = "UserId";
                }
            }
        }

This is working, but I use the Excel-Filter and there I see only the UserId. How can I change this?

I try this instead of the code above, but it is not working.
gridGroupingControl1.TableDescriptor.Columns["CreateUser"].Appearance.AnyRecordFieldCell.DataSource = userBindingSource.DataSource;
gridGroupingControl1.TableDescriptor.Columns["CreateUser"].Appearance.AnyRecordFieldCell.DisplayMember = "Lastname";
gridGroupingControl1.TableDescriptor.Columns["CreateUser"].Appearance.AnyRecordFieldCell.ValueMember = "UserId";
gridGroupingControl1.TableDescriptor.Columns["CreateUser"].Appearance.ColumnHeaderCell.DataSource = userBindingSource.DataSource;
gridGroupingControl1.TableDescriptor.Columns["CreateUser"].Appearance.ColumnHeaderCell.DisplayMember = "Lastname";
gridGroupingControl1.TableDescriptor.Columns["CreateUser"].Appearance.ColumnHeaderCell.ValueMember = "UserId";

And my next question. Is it possible to remove the DropDownButton in the GridListControl in the User-Cell?

Thanks for your support
BR Thomas


Amal Raj Umapathy Selvam [Syncfusion]
Replied On January 16, 2017 01:25 AM

Hi Thomas, 

Thanks for using Syncfusion products. 

 
 
 
 
 
 I use the Excel-Filter and there I see only the UserId. How can I change this? 
We are able to understand your scenario. In order to filter by display member of the column in GridExcelFilter then the display member and value member must be defined through default styles, since we do not have support for filter by display member while using QueryCellStyleInfo events. Please make use of the below code, 

Code Example 
//to enable GridExcelFilter filter by display member. 
this.gridGroupingControl1.TableDescriptor.Columns["User"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.GridListControl; 
this.gridGroupingControl1.TableDescriptor.Columns["User"].Appearance.AnyRecordFieldCell.DataSource = childTable; 
this.gridGroupingControl1.TableDescriptor.Columns["User"].Appearance.AnyRecordFieldCell.DisplayMember = "LastName"
this.gridGroupingControl1.TableDescriptor.Columns["User"].Appearance.AnyRecordFieldCell.ValueMember = "UserID"
 


Is it possible to remove the DropDownButton in the GridListControl in the User-Cell? 
In order to disable the DropDownButton in the GridListControl in cells, then the ShowButtons property can be used. Please make use of the below code, 
 
Code Example 
//to disable the dropdown buttons. 
this.gridGroupingControl1.TableDescriptor.Columns["User"].Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Hide; 
 


Sample Link 

 

Regards, 
Amal Raj U. 


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.

;