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

Adding dynamic datasource to dynamic Combobox''s in Grid Control

hi,

I have a grid Control, I would like to dynamically add rows(on a event) in a grid, in which two of the columns contain comboboxes, If i change the selection of one combobox, I would like to dynamically bind the other combobox (based on the selection). Could you please show hw this possible in the Syncfusion grid and give some pointers towards the same.

Thanks in Advance.

Raul D'souza

3 Replies

HA haneefm Syncfusion Team May 15, 2007 04:04 PM UTC

Hi Rahul,

If you wan to change the datasource for the specific cell based on some condition then handle the CurrentCellShowingDropDown event to place your new datatable directly into the GridComboBoxCellRenderer.ListBoxPart. This will affect the dropped cell datasource. Please refer to the attached sample for implementation and let me know if this helps.

Sample : ComboxDatasource.zip

Also refer the below KBs for more information.
http://www.syncfusion.com/Support/article.aspx?id=567
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=115&catId=12

Best regards,
Haneef


RA Raul May 17, 2007 04:50 PM UTC

hey Haneef,

Thanks a lot for your help, However I am a newbie to Syncfusion grid and would also like to know hw do I add a new row in DGBG?


HA haneefm Syncfusion Team May 17, 2007 05:36 PM UTC

Hi Rahul,

Thank you for your update.

Issue 1: showing AddNewRow..

If you want to to show the extra row( Addnew row ) in a grid, you can set the EnableAddNew property to True.

this.gridDataBoundGrid1.EnableAddNew = false;

Issue 2: adding a new row.

To add or remove rows in a grid, you just do it by working with the underlying datasource. The grid should automatically reflect the changes. Here is a code snippet that show this.

this.gridDataBoundGrid1.BeginUpdate();
DataTable dt = this.gridDataBoundGrid1.DataSourec as DataTable.
DataRow dr = dt.NewRow();
dr[0] = "NewRow";
dt.Rows.Add(dr);
this.gridDataBoundGrid1.EndUpdate();

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon