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.

ComboBox Selected Value

Thread ID:

Created:

Updated:

Platform:

Replies:

21893 Nov 25,2004 05:38 PM Nov 26,2004 01:20 AM Windows Forms 1
loading
Tags: GridControl
Bernard Herrok
Asked On November 25, 2004 05:38 PM

Hi, I have a databound grid with a cell which is of type combobox (bound to another dataset). I''d like to set the next 2 cells enabled/disabled according to the selection of the combobox. e.g. if combobox is "Next Year" then the next 2 cells are disable if it''s "Base Year" then the next 2 cells are enabled. Thanks in advanced.

Administrator [Syncfusion]
Replied On November 26, 2004 01:20 AM

Try handling the grid.Model.QueryCellInfo event. In your handler, if e.RowIndex > 0 and if e.ColIndex points to one of the ''next two cells'' you mentioned, then get the value of the comboxcell and set e.Style.Enabled accordingly.
private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
	if(e.RowIndex > 0)
	{
		if(e.ColIndex == this.grid.Binder.NameToColIndex("NextCol1")
			|| e.ColIndex == this.grid.Binder.NameToColIndex("NextCol2"))
		{
			int col = this.grid.Binder.NameToColIndex("ComboCol");
			string val = this.grid[e.RowIndex, col].Text; //may want .FormattedText
			if(val == "NextYear")
				e.Style.Enabled = true;
			else
				e.Style.Enabled = false;
		}
	}
}

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.

;