简体   繁体   中英

Server.transfer postback issue

I have a button that does a server.transfer to another aspx page. 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.

'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? I will resort to responce.redirect but I would prefer to use server.transfer

Any thoughts or input is appreciated, thanks

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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