We need to see your Page_Load routine. The Load event will indeed run each and every time. If there is code that should only run the first time the user visits the page, you isoloate that code within an "IsPostBack" conditional.
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
It sounds to me like you could try checking if it's a postback then execute proper code, because Page_Load will execute every time, no matter post back or a regular visit.
If Not Page.IsPostBack then
... do something
End If
senexom
Junior Poster in Training
54 posts since Jun 2005
Reputation Points: 11
Solved Threads: 0
I'm not sure if this is a problem you've been having when you say "... It worked initially but something else further down the line didn't work ..."
Be aware that if you set a variable before postback and then check it after postback it will be reset, use Session or ViewState to keep variable values regardless of postback state.
senexom
Junior Poster in Training
54 posts since Jun 2005
Reputation Points: 11
Solved Threads: 0
Yep PostBack variable is off limits, use your own variable and check it something like so...
If Page.IsPostBack AND MyVar = True Then
MyVar = False
Else
MyVar = True
End If
senexom
Junior Poster in Training
54 posts since Jun 2005
Reputation Points: 11
Solved Threads: 0
You can still use hidden form elements. Just iterate through the Request.Form. I don't think you need Session or ViewState or tricks with PostBack. Just pass in a hidden form element value. If it's true, run your randomizer. If not, don't.
tgreer
Made Her Cry
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37