PreviousPage.IsCrossPagePostBack仅适用于一次 [英] PreviousPage.IsCrossPagePostBack Only works Once

查看:54
本文介绍了PreviousPage.IsCrossPagePostBack仅适用于一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不确定这是不是正确的地方,但现在这样。

Not sure if this is the right place but here goes.

我创建了四个页面test1.aspx ,每个页面上的test2.aspx,test3.aspx和test4.aspx是一个名为textbox1和一个按钮的文本框。

I have created four pages test1.aspx, test2.aspx, test3.aspx and test4.aspx on each page is a textbox called textbox1 and a button.

如果单击按钮而没有在textbox1中输入任何内容,则在test1.aspx上重定向到一个错误页面,这是有效的。

On test1.aspx if you click the button without entering anything in textbox1 you get redirected to an error page, this works.

如果在test1.aspx上你输入'Member'到textbox1并点击按钮你去test2.aspx和文本'会员'现在出现在test2.aspx的textbox1中,这有效。

If on test1.aspx you enter ‘Member’ into textbox1 and click the button you go to test2.aspx and the text ‘Member’ now appears in the textbox1 on test2.aspx, this works.

但是如果你现在点击test2.aspx上的按钮,文本框中的内容就不会传输而你会收到错误,为什么?

However if you now click the button on test2.aspx the contents from the text box do not transfer and you get an error, Why?

有谁知道如何解决这个问题?

Does anyone know how to fix this?

我有以下代码


   
受保护 Sub Page_Load(发件人
As Object ,e
As
System。 EventArgs
句柄
。加载

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load


 


        
如果 PreviousPage IsNot
没什么 AndAlso PreviousPage.IsCrossPagePostBack
然后

        If PreviousPage IsNot Nothing AndAlso PreviousPage.IsCrossPagePostBack Then


           
Dim SourceTextBox
As
TextBox

            Dim SourceTextBox As TextBox


           
SourceTextBox = CType (PreviousPage.FindControl(" TextBox1" ) ,
TextBox

            SourceTextBox = CType(PreviousPage.FindControl("TextBox1"), TextBox)


      ;      
如果 SourceTextBox.Text =
"会员"
然后

            If SourceTextBox.Text = "Member" Then


                
TextBox1.Text = SourceTextBox.Text

                TextBox1.Text = SourceTextBox.Text


            
其他

            Else


                
Response.Redirect("〜/ error.aspx?消息=您需要登录"
True

                Response.Redirect("~/error.aspx?Message=You need to login", True)


       
     结束
如果

            End If


       
其他

        Else


            
Response.Redirect("〜/ error.aspx?消息=您需要登录"
True

            Response.Redirect("~/error.aspx?Message=You need to login", True)


       
结束 如果

        End If


 


   
结束 Sub

    End Sub

 

Richard

推荐答案

理查德,

因为你的问题是关于ASP.NET的。我建议您最好将其发布到ASP.Net论坛以获得更好的支持:

Since your issue is about ASP.NET. I suggest you‘d better to post it to ASP.Net forum for better support:

http://forums.asp.net/

感谢您的理解。

最好的问候,

Lake Xiao

Lake Xiao


这篇关于PreviousPage.IsCrossPagePostBack仅适用于一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆