左右二个框架,点击右页面的登录按钮,在左框架中显示登录信息,我用session传值,点击按钮后给session赋值,左面的页面在LOAD时接收显示session的内容,问题是左面的页面不刷新,所以session的值传不进去,代码如下:
Private Sub imgbtnOK_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgbtnOK.Click
Dim connectStr As SqlClient.SqlConnection
Dim cmdSql As SqlCommand
Dim dtrData As SqlDataReader
connectStr = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings("constr"))
connectStr.Open()
cmdSql = New SqlCommand("select * from userinfo where userid ='" & Trim(txtUsername.Text) & "' and password='" & Trim(txtPassword.Text) & "'", connectStr)
dtrData = cmdSql.ExecuteReader
If dtrData.Read Then
Response.Write("<script>top.left.location.reload()</script>")
Response.Redirect("Setup.aspx") Else
Response.Write("<script>alert('用户名或密码错误!')</script>") End If
connectStr.Close()
Else
If Trim(txtUsername.Text) = "" Then Response.Write("请输入用户名!")
If Trim(txtPassword.Text) = "" Then Response.Write("请输入密码!")
End If
end sub
我使用了Response.Write("<script>top.left.location.reload()</script>")来刷新左框架的页面,但是没有用,但如果我把这个语句写到 Private Sub imgbtnOK_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgbtnOK.Click后的第一句就可以,请高手指点一二
Private Sub imgbtnOK_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgbtnOK.Click
Dim connectStr As SqlClient.SqlConnection
Dim cmdSql As SqlCommand
Dim dtrData As SqlDataReader
connectStr = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings("constr"))
connectStr.Open()
cmdSql = New SqlCommand("select * from userinfo where userid ='" & Trim(txtUsername.Text) & "' and password='" & Trim(txtPassword.Text) & "'", connectStr)
dtrData = cmdSql.ExecuteReader
If dtrData.Read Then
Response.Write("<script>top.left.location.reload()</script>")
Response.Redirect("Setup.aspx") Else
Response.Write("<script>alert('用户名或密码错误!')</script>") End If
connectStr.Close()
Else
If Trim(txtUsername.Text) = "" Then Response.Write("请输入用户名!")
If Trim(txtPassword.Text) = "" Then Response.Write("请输入密码!")
End If
end sub
我使用了Response.Write("<script>top.left.location.reload()</script>")来刷新左框架的页面,但是没有用,但如果我把这个语句写到 Private Sub imgbtnOK_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgbtnOK.Click后的第一句就可以,请高手指点一二
解决方案 »
- 普通网站如何做并发的系统?
- .net和java,到底学哪个好(或者先学哪个好)?
- Office2007里access 如何加密?
- 求一个简单的asp.net文本编辑器源码或者实现方式的文章
- 怎么在静态页面读出数据库的值
- 第一次才能搜索,很迷惑请大家帮分析一下。
- javascript怎么取session中的值(该session中的值是c#写的类)
- 配置服务器,SQL Server2005 + Windows Server 2008的Windows身份验证模式
- 数据库updata时报错,insert和delete时OK的
- 请问我做的工程中有13个TABLE,CONNECTION我就用一个,DATAADAPTER是不是有几个表就要从工具BOX里拖几个上去
- @@@@@@@@@@@@@@@@@为什么票字无法用REQUEST获取呢···············
- textbox格式存取问题!!!高人指点!!!!
Response.Redirect("Setup.aspx")改成Response.Wirte("<script>top.left.location.reload();window.location.href('Setup.aspx');</script>")
再试试
Response.Wirte("<script>top.left.location.location.href('左框架的页面');window.location.href('Setup.aspx');</script>")