日期:2014-05-20  浏览次数:20386 次

【菜鸟求助】关于“A01”并不包含“webgrid1”的定义,谁知道是为什么啊?
public   partial   class   A01   :   System.Web.UI.Page
{  
        protected   void   Page_Load(object   sender,   EventArgs   e)
        {
                string   StrCom   =   "select   *   from   Log02   where   Log02002   =   ' "   +   Session[ "UserId "].ToString()   +   " 'order   by   Log02007   DESC ";

                DataSet   Ds   =   new   DataSet();
                OperatorDB.SelectData(StrCom,   Ds,   false);

               
                this.WebGrid1.DataSource   =   Ds.Tables[0];
                this.WebGrid1.DataBind();

        }

以上是代码,运行到this.WebGrid1.DataSource   =   Ds.Tables[0];的时候就报错,所“A01”并不包含“webgrid1”的定义
但是,我使用this.是可以点出webgrid1这个控件的,不知道是为什么了。。。


webgrid1是C1的grid控件。我已经添加了引用的说。谢谢!

------解决方案--------------------
//应该要这样写
this.DGView.DataSource = ds;
this.DGView.DataMember = ds.Tables[0].TableName;
this.DGView.DataKeyField = ds.Tables[0].Columns[ "id "].ColumnName;
this.DGView.DataBind();