Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

refresh problems..

Status
Not open for further replies.

CGreenMTU

Programmer
May 27, 2004
61
US
I am transfering a value from one web form to another using a click event on the source form. Once the value is carried to the second web form, there are 2 buttons on the form. One of them is (Add Another Claimant), and another is (Add Another Transacation). I would like the value that was transfered to stay filled when i click these buttons, however, clicking these buttons seems to refresh the page and i lose that value. any suggestions for keeping it?

here is my code to transfer the value:

'Source form (NewClaim.aspx)
Private Sub lnkAddClaimant_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkAddClaimant.Click
Context.Items.Add("Claim Number", txtClaimNUmber.Text)
Server.Transfer("Claimant1.aspx")

'Destination form (Claimant1.aspx)
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtClaimNum.Text = Context.Items("Claim Number")
 
make sure where ever you store that value enableViewState = True
 
And if ViewState is enabled, do this:

'set the text only on the first request and
'let ViewState retain the value afterwards
If Not IsPostBack Then
txtClaimNum.Text = Context.Items("Claim Number")
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top