0
我想在GridView中显示我的数据。 它工作正常,直到。 。 。 。 。 我想分页(每页20个数据),它会导致错误NotSupportedException未处理。NotSupportedException未处理(GridView的C#)
我该如何解决这个问题?
这是我的代码。 我也设置了分页为true。
public void bindGV()
{
string strCon = Database.GetConStr();
SqlConnection sqlCon = new SqlConnection(strCon);
SqlCommand sqlCommand = new SqlCommand("select * from Account", sqlCon);
sqlCon.Open();
SqlDataReader reader = sqlCommand.ExecuteReader();
StaffGV.DataSource = reader;
StaffGV.DataBind();
}
protected void GV_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GV.PageIndex = e.NewPageIndex;
bindGV();
}
错误来自GV_PageIndex。
通过这样做,我仍然有同样的错误。这是为什么? – Nana 2009-10-22 05:40:26
编辑您自己的问题并发布异常的堆栈跟踪。 – shahkalpesh 2009-10-22 05:45:06