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 events

Hi, is there a way to capture the OnChange event from a cell of CellType = "ComboBox", in a GridGroupingControl, at the stage when creating a new entry or editing an existing entry?
I have the following situation: An item is selected from ComboBox1 and upon selecting such an item, ComboBox2 is to be updated respectively. Thanks.


1 Reply

JA Janagan Syncfusion Team May 9, 2008 03:06 PM UTC

Hi,

Thanks for your interest in Syncfusion products.

You can retrive the values in one dropdownlist in the grid based on selection of values in the other dropdown as mentioned in the code below:



protected void GridGroupingControl1_QueryCellStyleInfo(object sender,Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{

if (e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{

if (e.TableCellIdentity.Column.MappingName == "DropDownSection")
{

DropDownList firstdropdownList, seconddropdownList;
firstdropdownList = new DropDownList();
seconddropdownList = new DropDownList();
Panel panel = new Panel();
panel.Controls.Add(firstdropdownList);
panel.Controls.Add(seconddropdownList);
firstdropdownList.AutoPostBack = true;
seconddropdownList.AutoPostBack = true;

PopulateFirstDropDown(firstdropdownList);
PopulateSecondDropDown(seconddropdownList);

firstdropdownList.SelectedIndexChanged += new EventHandler(firstdropdownList_SelectedIndexChanged);
seconddropdownList.SelectedIndexChanged += new EventHandler(seconddropdownList_SelectedIndexChanged);

TemplateClass mytemp = new TemplateClass(panel);
GridGroupingControl1.TableDescriptor.Columns.FindByMappingName("DropDownSection").ItemTemplate = mytemp;

}
}
}



http://websamples.syncfusion.com/samples/Grid.Web/6.1.0.34/29283_378a085c/29283/main.htm

Please try running the sample and let me know if this helps.

Thanks,
Janagan.




Loader.
Live Chat Icon For mobile
Up arrow icon