how to add checked items in checkedlistbox to ultrawingrid programmatically and delete the row same on uncheck?
private void lstManagers_ItemSelectionChanged(object sender, ItemSelectionChangedEventArgs e) {
classData Service = new cAssetsData(); DataTable dt = Service.Method((int)e.SelectedItems[0].Tag); this.ultrawingrid1.DataSource = dt; for (int i = 0; i < checkedlistbox1.Items.Count; i++) { dt.Rows.Add(checkedlistbox1.Items[i]); }
}
Hello,
I am just checking about the progress of this issue. Let me know If you need my further assistance on this issue
Thank you for using Infragistics Components.
Hello Rohan,
You could use the ItemCheck event of the CheckedListBox in order to achieve the desired by you functionality. When the checked state of an item is changed that event fires and if the state is “Checked” you could add that item into the DataTable the same logic is also valid if the state becomes “Unchecked” you could remove the item from the DataTable. As the UltraGrid and the DataTable are connected each modification of the DataTable will be visualized into the UltraGrid.
I have implemented that suggestion in a simple sample and you could run and evaluate it. Please see attached zip.
Please do not hesitate to contact me if you have any additional questions.
private void checkedlistbox1_ItemSelectionChanged(object sender, ItemSelectionChangedEventArgs e){
classData Service = new cAssetsData();DataTable dt = Service.Method((int)e.SelectedItems[0].Tag);this.ultrawingrid1.DataSource = dt;for (int i = 0; i < checkedlistbox1.Items.Count; i++){dt.Rows.Add(checkedlistbox1.Items[i]);}