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

How to set the datatable which has been binded to a column

Thread ID:

Created:

Updated:

Platform:

Replies:

120554 Sep 25,2015 12:50 AM UTC Sep 28,2015 06:17 AM UTC WinForms 3
loading
Tags: GridGroupingControl
ligyste
Asked On September 25, 2015 12:50 AM UTC




I had binded a datatable to a datagrouping's column
            DataTable t = new DataTable();

            this.gridGroupingControl1.TableDescriptor.Columns["UserID"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.GridListControl;
            this.gridGroupingControl1.TableDescriptor.Columns["UserID"].Appearance.AnyRecordFieldCell.DataSource = t;

And I use the CurrentCellShowingDropDown event
  private void drugListGridGroupingControl_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e)
        {
            
            if (e.TableControl.CurrentCell.Renderer is GridDropDownGridListControlCellRenderer)
            {
                GridDropDownGridListControlCellRenderer renderer = e.TableControl.CurrentCell.Renderer as GridDropDownGridListControlCellRenderer;
                renderer.ListControlPart.ItemHeight = 30;
                renderer.ListControlPart.AutoSizeColumns = true;
            }
        }


I want to set the table in the dropdown list.
1、How should I set the column's witdth.
2、How should I set the column headrow's height.
3、How should I set the cell into readonly except user uses the dropdown list.
thanks!

Attachment: Xshot0004_99e0ce40.zip

Adhikesevan Kothandaraman [Syncfusion]
Replied On September 25, 2015 04:44 PM UTC

Hi Ligyste,

Thanks for contacting Syncfusion Support.

To customize the dropdown GridListControl’s column width and the row height, we need to get the renderer of the GridDropDownGridListControlCellRenderer cell using this renderer we can customize the grid of the ListControlPart. Please refer to the following code example,

Code Example:

GridDropDownGridListControlCellRenderer cellRenderer = this.gridGroupingControl1.TableControl.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer;

cellRenderer.ListControlPart.Grid.ColWidths[1] = 200;

cellRenderer.ListControlPart.Grid.RowHeights[0] = 30;

To restrict the edit mode of the cell we can set the ReadOnly for the cell in the query cell info event. Please refer to the following code example,

Code Example:
this.gridGroupingControl1.QueryCellStyleInfo += gridGroupingControl1_QueryCellStyleInfo;

void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)

{

    if (e.TableCellIdentity != null && e.TableCellIdentity.Column != null

        && e.TableCellIdentity.Column.Name == "City")

    {

        GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;

        if (cc.HasCurrentCellAt(e.TableCellIdentity.RowIndex, e.TableCellIdentity.ColIndex))

        {

            if (cc.IsDroppedDown)

                e.Style.ReadOnly = false;

            else

                e.Style.ReadOnly = true;

        }

    }
}

Sample:
http://www.syncfusion.com/downloads/support/forum/120554/ze/CS-221767763

Regards,
Adhi


ligyste
Replied On September 26, 2015 12:17 AM UTC

Thank you ,it's very helpful for me

Adhikesevan Kothandaraman [Syncfusion]
Replied On September 28, 2015 06:17 AM UTC

Hi Ligyste,

We are happy that the provided information was helpful to you. Please contact us if you need any further assistance.

Regards,
Adhi

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.

Please sign in to access our forum

or the page will be automatically redirected to 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

;