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. Image for the cookie policy date

Get selected DisplayMember value from a GridListControl

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

3 Replies

AD Administrator Syncfusion Team June 26, 2005 06: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;


JS John Slater June 26, 2005 07: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; >


AD Administrator Syncfusion Team June 26, 2005 09: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
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon