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
close icon

ComboBox Selected Value

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.

1 Reply

AD Administrator Syncfusion Team November 26, 2004 06:20 AM UTC

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;
				e.Style.Enabled = false;

Live Chat Icon For mobile
Up arrow icon