Hello,
I often use the following code :
<code lang="cs>
gvLignes.GetDataSourceRowIndex(gvLignes.FocusedRowHandle)
</code>
I would like to have the GridView.GetFocusedDataSourceRowIndex method. It will be more readable and less error prone.
And it's pretty easy to add (I think)
Thanx for listening
Julien
Hello Julien,
Thank you for the suggestion. However, you can easily introduce this method yourself using extensions:
.... int datasourceIndex = gridView1.GetFocusedRowDataSourceIndex(); .... public static class MyGridViewExtension { public static int GetFocusedRowDataSourceIndex(this GridView view) { return view.GetDataSourceRowIndex(view.FocusedRowHandle); } }
Please try this solution and inform us of your results.
Thanks,
Stan.
Hello,
I understand that extention methos are a correct way to create such a functionnality.
But I must admit that I don't understand that you don't provide this to all of your users. Can you explain to me why you rejected this suggestion ?
TIA
Julien
Hello Julien,
I thought that the solution I provided was enough to achieve the required feature and it was not necessary to overload our GridView class with additional methods. Other people will be able to find this suggestion with ease and use the same approach. However, if this solution doesn't meet your requirements, I'll accept this suggestion and we'll consider introducing this method in the future.
Thanks,
Stan.
The following method has been added:
ColumnView.GetFocusedDataSourceRowIndex();