不知是哪里错了,请帮忙看一下。
public class idbSample : System.Web.UI.Page
{
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
protected System.Web.UI.WebControls.DataGrid FormatDataGrid;
private DataSet _dsContacts;
private void Page_Load(object sender, System.EventArgs e)
{
_dsContacts = new DataSet();
_dsContacts.ReadXml(Server.MapPath("Contacts.xml"));
DataColumn[] dcPk = {_dsContacts.Tables["Contact"].Columns["Email"]};
_dsContacts.Tables["Contact"].PrimaryKey = dcPk;
if (!Page.IsPostBack )
{
BindContacts();
}
}
private void BindContacts()
{
DataView dv = new DataView(_dsContacts.Tables["Contact"]);
dv.Sort = "LastName, FirstName";
FormatDataGrid.DataSource = dv;
FormatDataGrid.DataBind();
}
protected string FormatFullName(object FirstName, object LastName)
{
return (string)LastName + ", " + (string)FirstName;
}
protected void dgContacts_ItemDataBound(object source,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
string isManager = (string)DataBinder.Eval(e.Item.DataItem, "Manager");
if (isManager == "1")
{
// ' 设定文字和背景颜色
e.Item.Cells[2].Text = "经理";
e.Item.Cells[2].Style.Add("font-weight", "bold");
e.Item.Cells[2].ForeColor = System.Drawing.Color.Red;
e.Item.BackColor = System.Drawing.Color.AliceBlue;
}
else
{
e.Item.Cells[2].Text = "普通员工";
}
}
}
}
出错提示:
“/DataGrid”应用程序中的服务器错误。
--------------------------------------------------------------------------------
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: CS0234: 类型或命名空间名称“Global”在类或命名空间“System.Web.UI.WebControls.DataGrid”中不存在(是否缺少程序集引用?)
源错误:
行 26:
行 27: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
行 28: public class Global_asax : DataGrid.Global {
行 29:
行 30: private static bool __initialized = false;
源文件: c:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\datagrid\827e165f\a4dd7967\8nectolt.0.cs 行: 28
不知道是哪里错了,请问为什么?