c# 4.0 - getdatasourcerowindex nullreference after filter using gridview (Devexpress Winform)? -
i'm using gridview devexpress. after use filter on component, there error nullreference. if don't using filter. there isn't error on code.
(int = 0; < gridview1.rowcount; i++) { datarow dr; dr = gridview1.getdatarow(gridview1.getdatasourcerowindex(i)); messagebox.show(dr[0].tostring()); }
that code. solution datarow value gridview after filter?
maybe problem using rowcount. datasourcerowindex based on index underlying datasource holds. thats not same. if grouping or sorting rowhandle of gridview changing. , rowcount shows how rows in gridview. must not equivalent datasourceindex.
try following datarow:
1.
foreach (datarow row in ((datatable)gridcontrol1.datasource).rows) { //here can access row via row variable }
you have know rowcount property cant used accessing rows safely!
if need further dont hesitate asking.
Comments
Post a Comment