We are working on ASP. net web pages, it is inevitable to transfer parameters between different web pages. Below are two common methods to transfer parameters between web pages: the efficiency of parameter transfer is not discussed here. I personally prefer to use session transfer and release it immediately after use. It is very convenient.
Sending Page code:<Font Style="Background-color: # FFFF00"><Font Style="Background-color: # FFFF00">
Private Sub imagebutton1_click () Sub Imagebutton1_click () Sub imagebutton1_click () Sub Imagebutton1_click ( Byval Sender As System. Object , Byval E As System. Web. UI. imageclickeventargs) Handles Imagebutton1.click
' Passing parameters through querystring or in session
' The following section is transmitted using querystring.
' Dim URL as string
' Url = "../search/localtemp. aspx. aspx? & Search = OK"
' If txtenterprisename. Text <> "" then
' Url = URL + "& E =" + txtenterprisename. Text
' End if
' If txtaddress. Text <> "" then
' Url = URL + "& A =" + txtaddress. Text
' End if
' If ddlprovice. selectedvalue <> "select Province" then
' Url = URL + "& P =" + ddlprovice. selectedvalue
' End if
' If ddlcity. selectedvalue <> "select city" then
' Url = URL + "$ c =" + ddlcity. selectedvalue
' End if
' If url = "../search/singledetailed. aspx? & Search = OK "then
' 'Error message
' End if
' Response. Redirect (URL)
' Next we use session to pass
Session ( " E " ) = Txtenterprisename. Text
Session ( " A " ) = Txtaddress. Text
Session ( " P " ) = Ddlprovice. selectedvalue
Session ( " C " ) = Ddlcity. selectedvalue
' Server. Transfer ()
Response. Redirect ( " ../Search/localtemp. aspx " )
End sub
</Font></Font>
Code of the Acceptance page: < Font Style = " Background-color: # FFFF00 " > < Font Style = " Background-color: # ffffff " > </ Font > < Font Style = " Background-color: # FFFF00 " >
Private Sub page_load () Sub Page_load ( Byval Sender As System. Object , Byval E As System. eventargs) Handles Mybase . Load
' Put user code to initialize the page here
If Not Ispostback Then
' If quesring is used
' Dim enname as string = request. querystring ["E"]
Dim Ename As String
Dim Eaddress As String
Dim Eprovice As String
Dim Ecity As String
Ename = Session ( " E " ). Tostring
Eaddress = Session ( " A " ). Tostring
Eprovice = Session ( " P " ). Tostring
Ecity = Session ( " C " ). Tostring
' ----
' Your code
' -----
' When you use finish
Session. Remove ( " E " )
Session. Remove ( " C " )
Session. Remove ( " A " )
Session. Remove ( " P " )
End If
End sub </ Font > </ Font >