Hi,
I have some hidden rows in the GDBG. I'm binding the grid to a DataTable which i gets updated as i get data.
So lets say there are 5 rows (column [ID] 5,4,3,2,1) in the datatable and so in the grid. I hide the 1st (i.e. [ID]=5) row in the grid. After some time when i get data and the datatable is updated with 6th row ([ID]=6) and I bind it to grid then my the row containing [ID]=6 is hidden. How to solve this problem?
Thanks,
Amiya
AD
Administrator
Syncfusion Team
March 13, 2007 09:44 PM UTC
Hi Amiya,
This is by design. If you want to hide a row based on the cellvalue than you can handle the QueryRowHeight event and set the e.Size to "ZERO". Here is a code snippet to show this.
this.grid.Model.QueryRowHeight +=new GridRowColSizeEventHandler(Model_QueryRowHeight);
private void Model_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
{
GridModel model = sender as GridModel;
if( e.Index > 0 && e.Index < model.RowCount &&
model[e.Index,1].Text == "11")
{
e.Size = 0;
e.Handled = true;
}
}
Best regards,
Haneef
AD
Administrator
Syncfusion Team
March 13, 2007 11:20 PM UTC
Haneef,
Is there any event which is raised after grid is databound? I want to see the changes in the DataView ((DataTable)grid.DataSource).DefaultView which I can't see in the next line after binding the grid.
Thanks,
Amiya
AD
Administrator
Syncfusion Team
March 14, 2007 04:30 PM UTC
Hi Amiya,
To detect the dataSource change in the grid, you need to use the Binder.DataSourceChanged Event. Here is a code snippet.
this.grid.Binder.DataSourceChanged +=new EventHandler(Binder_DataSourceChanged);
private void Binder_DataSourceChanged(object sender, EventArgs e)
{
Console.WriteLine(" DataSource Changes");
}
If you want to detect the underlying list changes in a grid then use Binder.BindingListChanged event of the grid.
this.grid.Binder.BindingListChanged +=new ListChangedEventHandler(Binder_BindingListChanged);
private void Binder_BindingListChanged(object sender, ListChangedEventArgs e)
{
Console.WriteLine("ListChaned");
}
Best regards,
Haneef