我有一个网格视图,它绑定到从学生类型中选择数据的对象数据源
public class student
{
int id;
string name;
int age;
public List<students> GetAllStudents()
{
// Here I'm retrieving a list of student from Database
}
}
在 UI 控件 ascx
<asp:GridView ID="MyGrid" runat="server"
DataSourceID="MyDataSource"
OnRowCommand="MyGrid_RowCommand">
</asp:GridView>
<asp:ObjectDataSource ID="MyDataSource" runat="server"
TypeName="student"
SelectMethod="GetAllStudents">
在 UI Control 代码后面
protected void MyGrid_RowCommand(object sender, GridViewCommandEventArgs e)
{
// Here I want to get the list of students from my gridview
}
我想检索网格中显示的数据列表,以便能够检查列表中最后一个学生的年龄值
请尽快帮助我
提前致谢