简体   繁体   English

Server.transfer 回发问题

[英]Server.transfer postback issue

I have a button that does a server.transfer to another aspx page.我有一个按钮可以将 server.transfer 转移到另一个 aspx 页面。 On the second page is a form with submit button.第二页是一个带有提交按钮的表单。 When clicking the submit button the page_load 'if not ispostback code' executes and wipes the form clear.单击提交按钮时,page_load 'if not ispostback code' 将执行并清除表单。

'First page
Context.Items.Add("ID", myID)
Server.Transfer("SecondPage.aspx")

'Second page
Protected Sub Page_Load(sender As Object, e As EventArgs)
    If Not IsPostBack Then
        ClearControls()
        _myID = Context.Items("ID")
        BindDropDowns()
    End If
End Sub

Protected Sub btnSave_Click(sender As Object, e As EventArgs)
    'Do save functions here
End Sub

Is this expected behavior of server.transfer?这是 server.transfer 的预期行为吗? I will resort to responce.redirect but I would prefer to use server.transfer我会求助于 responce.redirect 但我更喜欢使用 server.transfer

Any thoughts or input is appreciated, thanks任何想法或意见表示赞赏,谢谢

Server.Transfer("SecondPage.aspx", True)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM