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

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -