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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page Load or IsPostBack?

Status
Not open for further replies.

jcs1953

IS-IT--Management
Nov 28, 2007
53
US
On my web page I have a textbox in which the doctor enters a patient ID. A dropdown list is populated with the avaliable test dates when he enters a patient id and hits the Enter key. There are several other buttons on the page that allow him to pull up different test panels based on the patient id and date. Both the patient id and date are set as session variables. I figured out how to display a java box asking to select a date if he forgets(after entering a patient ID)and selects one of the panels first. My question is how do set the Session variable for Patient ID to " " on the initial page load without it resetting to " " every time the page reloads?
Maybe IsPostBack or something along those lines?
Thanks
 
Got it figured out. I used this:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Session("PatientName") = " "
Session("startdate") = " "
End If
End Sub
 
OK. It only worked once. I'm open to suggestions.
 
don't use session for this. managing the session for getting the patient id complicates, rather than simplifies the workflow.

if you are using the patient id on another page pass the patient id either using POST or GET. if you are using the patient id on the same webform take advantage of the postback model and pull the patient id from the textbox value.

same goes for the start date.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top