检查你的UserControl_friend.bntSubmit_Click(Object sender, ImageClickEventArgs e)中的代码。
应该在这个文件的第2036行,看看那个变量是null的。或者把这个函数贴出来吧。

解决方案 »

  1.   

    这个文件没有那么多行啊最后一个字符也是第197行,没有第2036行protected void bntSubmit_Click(object sender, ImageClickEventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }
            if (Request.Cookies["CheckCode"] == null)
            {
                return;
            }
            if (String.Compare(Request.Cookies["CheckCode"].Value, this.txtDatabase.Value, true) != 0)
            {
                lblMsg.Visible = true;
                lblMsg.Text = "验证码不正确!";
                return;
            }        if (txtMap.Value.Trim() != "")
            {
                if (GetUploadImgs(txtMap) == null)
                {
                    return;
                }
            }        if (Request.QueryString["ID"] != null && Request.QueryString["ID"] != "")
            {
                string title = txtTitle.Value.Trim();
                string self = txtDesc.Value.Trim();
                string email = txtEmail.Value.Trim();
                string name = txtName.Value.Trim();
                string tel = txtTel.Value.Trim();
                string other = txtOther.Value.Trim();
                string picpath = GetUploadImgsUrl();
                if (picpath != "0")
                {
                    string[] cols = { "title", "self", "email", "name", "tel", "other", "picpath", "createtime" };
                    string[] values = { title, self, email, name, tel, other, picpath, DateTime.Now.ToString() };
                    service.UpdateFriend(cols, values, Request.QueryString["ID"]);
                    lblMsg.Visible = true;
                    lblMsg.Text = "保存成功!";
                }
                else
                {
                    string[] cols = { "title", "self", "email", "name", "tel", "other", "createtime" };
                    string[] values = { title, self, email, name, tel, other, DateTime.Now.ToString() };
                    service.UpdateFriend(cols, values, Request.QueryString["ID"]);
                    lblMsg.Visible = true;
                    lblMsg.Text = "保存成功!";
                }
            }
            else
            {
                Entities.friend friend = EntityFactory<Entities.friend>.CreateObject();
                friend.title = txtTitle.Value.Trim();
                friend.picpath = GetUploadImgsUrl();
                DataTable citydt = service.FindArea(" and id=" + Request.QueryString["areaid"]).Tables[0];
                friend.city = int.Parse(GetRoots(citydt, 1));
                DataTable areadt = service.FindArea(" and parentid=" + GetRoots(citydt, 1)).Tables[0];
                if (areadt.Rows.Count > 0)
                {
                    friend.area = int.Parse(areadt.Rows[0]["id"].ToString());                DataTable streetdt = service.FindArea(" and parentid=" + areadt.Rows[0]["id"].ToString()).Tables[0];
                    if (streetdt.Rows.Count > 0)
                    {
                        friend.street = int.Parse(streetdt.Rows[0]["id"].ToString());
                    }
                }
                friend.categoryid = int.Parse(Request.QueryString["categoryid"]);
                friend.createid = int.Parse(Session["Userid"].ToString() == "" ? "0" : Session["Userid"].ToString());
                friend.createtime = DateTime.Now;
                friend.email = txtEmail.Value.Trim();
                friend.name = txtName.Value.Trim();
                friend.other = txtOther.Value.Trim();
                friend.self = txtDesc.Value.Trim();
                friend.tel = txtTel.Value.Trim();
                service.InsertFriend(friend);            lblMsg.Visible = true;
                lblMsg.Text = "保存成功!";
            }
        }
      

  2.   

    反正你的这段代码又不长,你就一个一个变量看看,哪个变量是null不就知道哪错了么
      

  3.   

    调试是没有任何异常的。发布之后在在本地的iis运行也没有任何问题但是放到服务器上就出现的这样的异常
      

  4.   

    compilation debug="true"
    或上服务器  运行,就能报出错误在哪里