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


Hi, I am using gridDataBoundGrid1 in my application. Q1: how do i delete selected row from gridDataBoundGrid1. [only display deletion not datatable] Help me...........!

1 Reply

AD Administrator Syncfusion Team July 15, 2005 11:11 AM UTC

If you do not want to remove it from the DataTable, then you will have to do some work depending on what you need. If you are not sorting the grid, then you can hide the row using code like: grid.Model.RowHeights[rowIndex] = 0; If you want to sort, then hiding the row as above does not keep the row hidden when you sort it and a new row might get hidden as it moves to the row whose height is zero. In this case, one way you can hide a row is to filter it out of teh DataTable using Datatable.DefaultView.RowFilter. This means you would have to write a filter that included only the rows you want visible. This may or may not be simple depending on what rows you are trying to remove. Another option is to handle teh grid.Model.QueryRowHeight, and if e.Index points to a row you want deleted, then you can set e.handled = true and e.Size = 0. To handle sorts, you would want to use e.Index - 1 as an index into the DataView associated with the grid. Then you could check a primary key value in teh DataRowView to see if this is a row you want hidden. CurrencyManager cm = grid.BindingContext[grid.DataSource, grid.DataMember] as CurrencyManager; DataView dv = cm.List as DataView; DataRowView drv = dv[e.Index-1]; if((int)drv["pkCol"] == 18) { e.Handled = true; e.Size = 0; }

Live Chat Icon For mobile
Up arrow icon