怎么样做一个注册页面??

Viali 2004-08-09 10:24:59
当注册信息满足验证控件的要求时候,进入成功注册。否则显示注册信息,并停留在注册页面。怎么样实现?关键是页面跳转那里怎么实现???
...全文
224 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Viali 2004-08-10
  • 打赏
  • 举报
回复
不是这样子喔。。我的意思实说,如果我在页面那里添加了一个TextBox控件,然后加了一个验证控件RequiredFieldValidator,那么我想实现,如果验证通过则跳转到NEXT.ASPX,否则出示错误信息,并不跳转页面...怎么实现?
shing1982 2004-08-10
  • 打赏
  • 举报
回复
同意楼上的
zy44995 2004-08-10
  • 打赏
  • 举报
回复
在加一个Validationsummary验证控件,这样就能出示错误信息并不跳转页面。
如果验证通过则跳转到NEXT.ASPX:
Private Sub btresume_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btresume.Click
Response.Redirect("next.aspx")
End Sub
fun1984 2004-08-09
  • 打赏
  • 举报
回复
页面跳转的实现:Response.Write("要跳转的页面");
实现后退页面:Response.Write("<script>history.back(-1);script>");
如果要实现后退(B后退到A)后显示的页面自动刷新,在B中加:
Response.CacheControl = "no-cache";
zy44995 2004-08-09
  • 打赏
  • 举报
回复
这是我的代码:
Private Sub btsubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btsubmit.Click
If Page.IsValid Then
Dim myconnection As OleDb.OleDbConnection
Dim mycommand As OleDb.OleDbCommand
Dim mycommand2 As OleDb.OleDbCommand
Dim newuser As String
Dim insertstring As String
Dim querystring As String
Dim useraddress As String
Dim userbirthday1 As String
Dim userbirthday As Date
Dim registerdate As Date
querystring = "Select * from userinfo where(username='" + tbusername.Text + "')"
myconnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db\info.mdb"))
mycommand2 = New OleDb.OleDbCommand(querystring, myconnection)
myconnection.Open()
Dim myReader As OleDb.OleDbDataReader
myReader = mycommand2.ExecuteReader()
If myReader.HasRows Then
Page.RegisterStartupScript("MsgBox", "<script>alert('用户名:" & tbusername.Text & "已存在!');</script>")
myReader.Close()
myconnection.Close()
Else
Dim sexstring As String
If RMan.Checked Then
sexstring = "男"
Else
sexstring = "女"
End If
myReader.Close()
registerdate = Now()
useraddress = province.SelectedItem.Text & tbcity.Text & tbaddress.Text
userbirthday1 = tbyear.Text & "," & month.SelectedItem.Text & "," & day.SelectedItem.Text
userbirthday = CDate(userbirthday1)
insertstring = "Insert into userinfo(username,passward,question,answer,name,sex,address,birthday,email,phone,registerdate,online) values('" + tbusername.Text + "','" + tbpassward.Text + "','" + question.SelectedItem.Text + "','" + tbanswer.Text + "', '" + tbname.Text + "','" + sexstring + "','" + useraddress + "','" + userbirthday + "','" + tbemail.Text + "','" + tbphone.Text + "','" + registerdate + "','false')"
mycommand = New OleDb.OleDbCommand(insertstring, myconnection)
mycommand.ExecuteNonQuery()
myconnection.Close()
'Label1.Text = "注册成功!!"
newuser = tbusername.Text
tbpassward.Text = ""
tbrepassward.Text = ""
tbname.Text = ""
tbcity.Text = ""
tbaddress.Text = ""
tbyear.Text = ""
tbaddress.Text = ""
tbemail.Text = ""
tbphone.Text = ""
Page.RegisterStartupScript("MsgBox", "<script>alert('新用户:" & newuser & ",注册成功!');</script>")
Response.Redirect("index.aspx?user=" & System.Web.HttpUtility.UrlEncode(newuser))

End If
End If
End Sub
dudu8686 2004-08-09
  • 打赏
  • 举报
回复
if ...... then
"请输入您的真实姓名!"
else
INSERT INTO database
response.redirect("ok.aspx")
end if

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧