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.

Get selected DisplayMember value from a GridListControl

Thread ID:

Created:

Updated:

Platform:

Replies:

30886 Jun 25,2005 09:21 PM Jun 26,2005 10:23 AM Windows Forms 3
loading
Tags: GridControl
John Slater
Asked On June 25, 2005 09:21 PM

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 07:47 AM

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 08:10 AM

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 10:23 AM

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.

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.

;