我正在开发一个遵循3层架构的Web应用程序。当我点击提交按钮时,数据存储在数据库中,但没有显示响应消息,如“记录提交成功”,字段不刷新。这是我的代码:
protected void BtnSubmit_Click(object sender, EventArgs e)
{
if (!Page.IsValid)
return;
NewuserBAL NUB = new NewuserBAL();
string UserName = TxtUserName.Text;
string Password = PWD.Text;
string EmailId = Email.Text;
try
{
NUB.newinsert(UserName, Password, EmailId);
Response.Write("<b>New User Created Successfully</b>");
TxtUserName.Text = "";
PWD.Text = "";
CnfrmPwd.Text = "";
Email.Text = "";
}
catch
{
throw;
}
finally
{
NUB = null;
}
}
谢谢, Masum
答案 0 :(得分:1)
不是使用Response.Write,而是设置labelResults之类的标签来显示结果。 Response.Write不会出现在渲染的HTML中的适当位置。