这面这段代码为什么不能绑定GridView1 控件调了一个晚上没能成功
一执行的时候就提示: 在 System.Web.UI.WebControls.BoundField.GetValue(Control controlContainer)
在 System.Web.UI.WebControls.BoundField.OnDataBindField(Object sender, EventArgs e)
在 System.Web.UI.Control.OnDataBinding(EventArgs e)
在 System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
在 System.Web.UI.Control.DataBind()
在 System.Web.UI.Control.DataBindChildren()
在 System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
在 System.Web.UI.Control.DataBind()
在 System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource)
在 System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding)
在 SmartLib.asp.net.Controls.GridViewEx.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) 位置 D:\开发\出版社\测试代码\jzlib\Smartlib\asp.net\Controls\GridViewEx.cs:行号 371
在 System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
在 System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data)
在 System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
在 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
在 System.Web.UI.WebControls.DataBoundControl.PerformSelect()
在 System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
在 System.Web.UI.WebControls.GridView.DataBind()
在 SmartLib.asp.net.Controls.GridViewEx.BindDataTable(DataTable table) 位置 D:\开发\出版社\测试代码\jzlib\Smartlib\asp.net\Controls\GridViewEx.cs:行号 472
在 SmartLib.asp.net.Controls.GridViewEx.OnBind() 位置 D:\开发\出版社\测试代码\jzlib\Smartlib\asp.net\Controls\GridViewEx.cs:行号 454
在 Admin_06_Admin_TextSite.Page_Load(Object sender, EventArgs e) 位置 d:\SenateManages\Admin\06\Admin_TextSite.aspx.cs:行号 36
在 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
在 System.Web.UI.Control.OnLoad(EventArgs e)
在 System.Web.UI.Control.LoadRecursive()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)怎么解决啊?
public partial class Admin_06_Admin_TextSite : System.Web.UI.Page
{
public static string OperType;
clsLogic clsLogic1 = new clsLogic();
ClsDbOper ClsDbOper1 = new ClsDbOper();
protected void Page_Load(object sender, EventArgs e)
{
ClsCommon.ChkLogin(Session["UserId"]);
if (!IsPostBack)
{
lblTitle.Text = "考场信息维护";
clsLogic1.GetOperGroup(Session["GroupId"], Session["UserId"], "考场信息", btnAdd, "添加");
clsLogic1.GetOperGroup(Session["GroupId"], Session["UserId"], "考场信息", btnQuery, "查询");
clsLogic1.GetOperGroup(Session["GroupId"], Session["UserId"], "考场信息", btnExport, "导出");
//绑定教室名称
string sql = "select JID,JName from T_Info_Classroom";
clsLogic1.InitDdlbySql(sql, ddlCID);
OperType = "1=2";
GridView1.OnBind();
}
}
protected void GetBin()
{
try
{
string sql = "SELECT a.ExamRoomId ,T_Info_Classroom.JName,a.ExamPer,a.SelectPer,a.Operator,a.OperDate,a.Re FROM T_Info_ExamRoom a left join T_Info_Classroom on T_Info_Classroom.JID = a.ClassRoom where " + OperType + " ";
if (ddlCID.SelectedValue == "0")
{
sql += " and a.ClassRoom ='" + ddlCID.SelectedValue.ToString() + "'";
}
if (txtDName.Text != "")
{
sql += " and T_Info_Classroom.JName like '%" + txtDName.Text.Trim() + "%'";
}
sql += " ORDER BY a.ExamRoomId desc"; DataTable dt = ClsDbOper1.GetDataTable(sql);
GridView1.DataSource = dt;
}
catch (Exception ex)
{
Response.Redirect("../ErrorMsg.aspx?ErrId=query&ErrMsg=" + ex.Message);
}
}
一执行的时候就提示: 在 System.Web.UI.WebControls.BoundField.GetValue(Control controlContainer)
在 System.Web.UI.WebControls.BoundField.OnDataBindField(Object sender, EventArgs e)
在 System.Web.UI.Control.OnDataBinding(EventArgs e)
在 System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
在 System.Web.UI.Control.DataBind()
在 System.Web.UI.Control.DataBindChildren()
在 System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
在 System.Web.UI.Control.DataBind()
在 System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource)
在 System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding)
在 SmartLib.asp.net.Controls.GridViewEx.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) 位置 D:\开发\出版社\测试代码\jzlib\Smartlib\asp.net\Controls\GridViewEx.cs:行号 371
在 System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
在 System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data)
在 System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
在 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
在 System.Web.UI.WebControls.DataBoundControl.PerformSelect()
在 System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
在 System.Web.UI.WebControls.GridView.DataBind()
在 SmartLib.asp.net.Controls.GridViewEx.BindDataTable(DataTable table) 位置 D:\开发\出版社\测试代码\jzlib\Smartlib\asp.net\Controls\GridViewEx.cs:行号 472
在 SmartLib.asp.net.Controls.GridViewEx.OnBind() 位置 D:\开发\出版社\测试代码\jzlib\Smartlib\asp.net\Controls\GridViewEx.cs:行号 454
在 Admin_06_Admin_TextSite.Page_Load(Object sender, EventArgs e) 位置 d:\SenateManages\Admin\06\Admin_TextSite.aspx.cs:行号 36
在 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
在 System.Web.UI.Control.OnLoad(EventArgs e)
在 System.Web.UI.Control.LoadRecursive()
在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)怎么解决啊?
public partial class Admin_06_Admin_TextSite : System.Web.UI.Page
{
public static string OperType;
clsLogic clsLogic1 = new clsLogic();
ClsDbOper ClsDbOper1 = new ClsDbOper();
protected void Page_Load(object sender, EventArgs e)
{
ClsCommon.ChkLogin(Session["UserId"]);
if (!IsPostBack)
{
lblTitle.Text = "考场信息维护";
clsLogic1.GetOperGroup(Session["GroupId"], Session["UserId"], "考场信息", btnAdd, "添加");
clsLogic1.GetOperGroup(Session["GroupId"], Session["UserId"], "考场信息", btnQuery, "查询");
clsLogic1.GetOperGroup(Session["GroupId"], Session["UserId"], "考场信息", btnExport, "导出");
//绑定教室名称
string sql = "select JID,JName from T_Info_Classroom";
clsLogic1.InitDdlbySql(sql, ddlCID);
OperType = "1=2";
GridView1.OnBind();
}
}
protected void GetBin()
{
try
{
string sql = "SELECT a.ExamRoomId ,T_Info_Classroom.JName,a.ExamPer,a.SelectPer,a.Operator,a.OperDate,a.Re FROM T_Info_ExamRoom a left join T_Info_Classroom on T_Info_Classroom.JID = a.ClassRoom where " + OperType + " ";
if (ddlCID.SelectedValue == "0")
{
sql += " and a.ClassRoom ='" + ddlCID.SelectedValue.ToString() + "'";
}
if (txtDName.Text != "")
{
sql += " and T_Info_Classroom.JName like '%" + txtDName.Text.Trim() + "%'";
}
sql += " ORDER BY a.ExamRoomId desc"; DataTable dt = ClsDbOper1.GetDataTable(sql);
GridView1.DataSource = dt;
}
catch (Exception ex)
{
Response.Redirect("../ErrorMsg.aspx?ErrId=query&ErrMsg=" + ex.Message);
}
}
你上面那一堆"在System.Web.UI.WebControls.BoundField.GetValue(Control controlContainer)..."是哪里出来的呀??