左右二个框架,点击右页面的登录按钮,在左框架中显示登录信息,我用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后的第一句就可以,请高手指点一二

解决方案 »

  1.   

    top.left.location.reload()---〉改成top.left.location.href('左框架的页面');试试,reload有时候是不刷新
      

  2.   

    Response.Write("<script>top.left.location.reload()</script>")
    Response.Redirect("Setup.aspx")改成Response.Wirte("<script>top.left.location.reload();window.location.href('Setup.aspx');</script>")
    再试试
      

  3.   

    或者
    Response.Wirte("<script>top.left.location.location.href('左框架的页面');window.location.href('Setup.aspx');</script>")
      

  4.   

    Response.Write("<body onload=\"parent.left.location.reload()\">");
      

  5.   

    不行啊,我如果把这句Response.Write("<script>top.left.location.reload()</script>")写到验证之前就可以刷新,但写到后面就不可以了,我真是莫明其妙啊
      

  6.   

    用的什么ide,设断点调试一下吧
      

  7.   

    谢谢zl13((.net转型中...)),问题解决了