首页上一页 1 下一页尾页 1 条记录 1/1页
ASP.NET项目开发案例全程实录(第2版)第12明日知道章怎么有那么多问题啊,没法运行
发表在ASP.NET图书答疑
2011-11-17
是否精华
是
否
版块置顶:
是
否
很多自定义控件都不能正确显示
下面这页问题特多 Question.aspx.cs页面
public partial class Question : System.Web.UI.Page
{
[u]DataClassesDataContext[/u] DC = new [u]DataClassesDataContext[/u]();显示未能找到命名空间
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (string.IsNullOrEmpty([u]ClientHelper[/u].UserCode))//显示当前上下文中不存在 {
Session["RedirectFrom"] = Request.Url;
Response.Redirect("NotLogin.aspx"); //
}
var query = from item in DC.tb_Catalog //
select new
{
Code = item.Code,
Name = item.Name
};
ddlCatalogCode.DataSource = query; //
ddlCatalogCode.DataTextField = "Name";
ddlCatalogCode.DataValueField = "Code";
ddlCatalogCode.DataBind();
}
}
//保存提问信息
protected void ibtnPostQuestion_Click(object sender, ImageClickEventArgs e)
{
if (!ValidateCode1.CheckSN(txtCheckCode.Text)) //
{
lblMessage.Text = "输入验证码不正确!";
return;
}
if (Page.IsValid)
{
[u]tb_UserInfo [/u]user = DC.tb_UserInfo.FirstOrDefault(itm => =显示未能找到命名空间
ClientHelper.UserCode);
if (txtMark.Text.Trim() != "" && user.Mark < Convert.ToInt32(txtMark.Text))
{
Response.Write("<Script>window.alert('用户的分数不足!')</Script>");
return;
}
[u]tb_Question [/u]question = new tb_Question(); //显示未能找到命名空间
question.Code = ClientHelper.BuildCode(); //
//给实体成员赋值
question.CatalogCode = ddlCatalogCode.SelectedValue;
question.UserCode = ClientHelper.UserCode;
question.Title = txtTitle.Text;
question.Text = txtText.Text;
if (txtMark.Text.Trim() !="")
question.Mark = Convert.ToInt32(txtMark.Text);
question.PostDatetime = ClientHelper.ServerDate;
question.State = 0; //
DC.tb_Question.InsertOnSubmit(question); //
[u]tb_Config [/u]config = DC.tb_Config.FirstOrDefault();显示未能找到命名空间
config.UnSolved = config.UnSolved + 1;
下面这页问题特多 Question.aspx.cs页面
public partial class Question : System.Web.UI.Page
{
[u]DataClassesDataContext[/u] DC = new [u]DataClassesDataContext[/u]();显示未能找到命名空间
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
if (string.IsNullOrEmpty([u]ClientHelper[/u].UserCode))//显示当前上下文中不存在 {
Session["RedirectFrom"] = Request.Url;
Response.Redirect("NotLogin.aspx"); //
}
var query = from item in DC.tb_Catalog //
select new
{
Code = item.Code,
Name = item.Name
};
ddlCatalogCode.DataSource = query; //
ddlCatalogCode.DataTextField = "Name";
ddlCatalogCode.DataValueField = "Code";
ddlCatalogCode.DataBind();
}
}
//保存提问信息
protected void ibtnPostQuestion_Click(object sender, ImageClickEventArgs e)
{
if (!ValidateCode1.CheckSN(txtCheckCode.Text)) //
{
lblMessage.Text = "输入验证码不正确!";
return;
}
if (Page.IsValid)
{
[u]tb_UserInfo [/u]user = DC.tb_UserInfo.FirstOrDefault(itm => =显示未能找到命名空间
ClientHelper.UserCode);
if (txtMark.Text.Trim() != "" && user.Mark < Convert.ToInt32(txtMark.Text))
{
Response.Write("<Script>window.alert('用户的分数不足!')</Script>");
return;
}
[u]tb_Question [/u]question = new tb_Question(); //显示未能找到命名空间
question.Code = ClientHelper.BuildCode(); //
//给实体成员赋值
question.CatalogCode = ddlCatalogCode.SelectedValue;
question.UserCode = ClientHelper.UserCode;
question.Title = txtTitle.Text;
question.Text = txtText.Text;
if (txtMark.Text.Trim() !="")
question.Mark = Convert.ToInt32(txtMark.Text);
question.PostDatetime = ClientHelper.ServerDate;
question.State = 0; //
DC.tb_Question.InsertOnSubmit(question); //
[u]tb_Config [/u]config = DC.tb_Config.FirstOrDefault();显示未能找到命名空间
config.UnSolved = config.UnSolved + 1;