<a href="Header/Register.aspx" class="header-login" id="register-link">注册</a>这是打开colorbox的链接$("#register-link").colorbox({
title: "注册页面",
scrolling: false,
onComplete: function () {
$.colorbox.resize();
}
});这是jQuery代码protected void Page_Load(object sender, EventArgs e)
{
txtUser.Attributes["onblur"] = ClientScript.GetPostBackEventReference(txtUser, null); //失去焦点触发
}
protected void txtUser_TextChanged(object sender, EventArgs e)
{
string sql = string.Format("SELECT count(*) FROM User_Info WHERE Username = '{0}'", txtUser.Text);
if (txtUser.Text == "")
{
lblUsername.Attributes.Add("style", "color: #ff0000");
lblUsername.Text = "不能为空!";
}
else if (Convert.ToInt32(DB.ReadFirst(sql)) != 0)
{
lblUsername.Attributes.Add("style", "color: #ff0000");
lblUsername.Text = "用户名已存在!";
}
else
{
lblUsername.Attributes.Add("style", "color: #06ff00");
lblUsername.Text = "可以注册!";
Session["Username"] = txtUser.Text;
}
}这个是Register.aspx的后台代码我的问题是这样的。。如果我单独打开Register.aspx 那么失去焦点的事件 是没有任何问题的 但是如果我通过主页点击链接 在弹出的colorbox里面显示的Register.aspx 一旦触发失去焦点的事件 就会报以下错误:
title: "注册页面",
scrolling: false,
onComplete: function () {
$.colorbox.resize();
}
});这是jQuery代码protected void Page_Load(object sender, EventArgs e)
{
txtUser.Attributes["onblur"] = ClientScript.GetPostBackEventReference(txtUser, null); //失去焦点触发
}
protected void txtUser_TextChanged(object sender, EventArgs e)
{
string sql = string.Format("SELECT count(*) FROM User_Info WHERE Username = '{0}'", txtUser.Text);
if (txtUser.Text == "")
{
lblUsername.Attributes.Add("style", "color: #ff0000");
lblUsername.Text = "不能为空!";
}
else if (Convert.ToInt32(DB.ReadFirst(sql)) != 0)
{
lblUsername.Attributes.Add("style", "color: #ff0000");
lblUsername.Text = "用户名已存在!";
}
else
{
lblUsername.Attributes.Add("style", "color: #06ff00");
lblUsername.Text = "可以注册!";
Session["Username"] = txtUser.Text;
}
}这个是Register.aspx的后台代码我的问题是这样的。。如果我单独打开Register.aspx 那么失去焦点的事件 是没有任何问题的 但是如果我通过主页点击链接 在弹出的colorbox里面显示的Register.aspx 一旦触发失去焦点的事件 就会报以下错误:
2:colorbox这种东东,我还是更愿意拿它去做图片展示,而不会去做这些东东或者你将其全部转为前端操作,数据处理使用ajax,或许衔接会更好.[仅供参考]