日期:2014-05-17  浏览次数:21063 次

C#新手求解 当前上下文中不存在名称“MessageBox”
我在DAL中已经加了一个MessageBox.cs类;
[code=C#][/code]using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using ZedGraph;
using System.Drawing;
using ZedGraph.Web;
using WebBLL;
using WebDAL;
using WebModel;

public partial class WebUI_AddNewLine : System.Web.UI.Page
{

  protected void Page_Load(object sender, EventArgs e)
  {
  if (!IsPostBack)
  {
  }
  }

  protected void Button1_Click(object sender, EventArgs e)
  {
  WebModel.Line_List model = new Line_List();
  model.LineID = Convert.ToInt32(TextBoxLineID.Text);
  model.LineName = TextBoxLineName.Text;
  model.U_level = TextBoxU_Level.Text;
  model.Head_Device_Name = TextBoxHead_Device_Name.Text;
  model.End_Device_Name = TextBoxEnd_Device_Name.Text;


  bool result = dal.Add(model);

  if (result)
  {
  MessageBox.ResponseScript(this.Page, "alert('添加成功'):");
  Response.Redirect("AddNewLine.aspx");
  }
  else
  {
  MessageBox.ResponseScript(this.Page, "alert('添加失败');");
  }
  }



顺便问下怎么把源代码剪切过来呢


------解决方案--------------------
你编译成功了吗?
WebDAL.MessageBox可以吗
MessageBox是静态类吗
------解决方案--------------------
重新引用你的DAL试试