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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Get selected DisplayMember value from a GridListControl

Thread ID:

Created:

Updated:

Platform:

Replies:

30886 Jun 26,2005 01:21 AM UTC Jun 26,2005 02:23 PM UTC WinForms 3
loading
Tags: GridControl
John Slater
Asked On June 26, 2005 01:21 AM UTC

I have a GDBG with a GridListControl, both have a DataSource. After selecting a record from the GridListControl dropdown, I would like to retrieve the DisplayMember value from it''s DataSource. I placed an event handler for the CurrentCellClosedDropDown which does get called, and examined the GDBG DataSource, but it still has the previous value (unless I click off the cell and then reselect it). How can I get the value from the GridListControl DataSource after the GridListControl DropDown closes? Thanks

Administrator [Syncfusion]
Replied On June 26, 2005 11:47 AM UTC

Normally, values are not moved back into the dtatsource until you leave the row. If you want to move them back when the dropdown closes, then try using this code in CurrentCellCloseDropDown. GridCurrentCell cc = grid.CurrentCell; cc.EndEdit(); grid.Binder.EndEdit(); string dispMember = grid[cc.RowIndex, cc.ColIndex].FormattedText;

John Slater
Replied On June 26, 2005 12:10 PM UTC

Thanks Clay, Worked perfectly. If I may impose another question while I''m on the subject of GridListControl. Is there a way to increase the size of some of the columns in the dropdown list. Thanks again. >Normally, values are not moved back into the dtatsource until you leave the row. If you want to move them back when the dropdown closes, then try using this code in CurrentCellCloseDropDown. > >GridCurrentCell cc = grid.CurrentCell; >cc.EndEdit(); >grid.Binder.EndEdit(); >string dispMember = grid[cc.RowIndex, cc.ColIndex].FormattedText; >

Administrator [Syncfusion]
Replied On June 26, 2005 02:23 PM UTC

You can conrol the width of things in CurrentCellShowingDropDown.
private void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.Renderer is GridDropDownGridListControlCellRenderer)
	{
		GridDropDownGridListControlCellRenderer cr = cc.Renderer 
					            as GridDropDownGridListControlCellRenderer;
		cr.ListControlPart.Grid.ColWidths[1] = 300; //set width of column
		e.Size = new Size(400, e.Size.Height); //set width of dropdown
	}
}

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

;