I have a gridview in my asp.net web app under 3.5. I bind gridview to the list. Inside the grid there are update and delete functions that work fine. But my save functions, for which I decided to extract the list from the data source, and then through the loop, I will introduce a new list into the database. But when I tried to get it in the usual way, it returned me zero.
I tried the following ways to return a list.
1. List<MyClass> list = (List<MyClass>gv.DataSource);
2. List<MyClass> list = gv.DataSource as List<MyClass>;
3. IDataSource idt = (IDataSource)gv.Datasource;
List<MyClass> list = (List<MyClass>)idt;
But no luck every time I got zero.
source
share