[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Matt P.

12/13/2001 6:28:00 PM

I have the following code which is used to fill two
dropdownlist on the initial page load event:

Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
Trace.Warn("in page load")
If (IsPostBack = False) Then
Activ.Items.Add("1 - Seated")
Activ.Items.Add("2 - Light Office Work")
Activ.Items.Add("3 - Walking Slowly")
Activ.Items.Add("4 - Light Bench Work")
Activ.Items.Add("5 - Medium Bench Work")
Activ.Items.Add("6 - Heavy Work")

Cloth.Items.Add("1 - Light Summer Office")
Cloth.Items.Add("2 - Medium Office Wear")
Cloth.Items.Add("3 - General Office")
Cloth.Items.Add("4 - Heavy Clothes")

Call ComCalc()
End If
End Sub

The problem is when I view the page there is two sets of
data in each of the lists. On debugging I see that the
page load event is called twice and both times its
postback is false. Can anyone explain this behaviour?
I've included the ComCal sub below for your reference.

Many Thanks, Matt



Private Sub ComCalc()
Dim arr As ArrayList = New ArrayList()
Dim i As Integer
Dim sLowVol As Single
Dim sHighVol As Single
Dim sVolrange As Single
Dim iNumSteps As Integer
Dim sVel As Single
Dim sIncr As Single
sLowVol = CSng(tboxLowVol.Text)
sHighVol = CSng(tboxHighVol.Text)
sVolrange = sHighVol - sLowVol
sIncr = CSng(tboxIncr.Text)
iNumSteps = CInt(sVolrange / sIncr)

For i = 0 To iNumSteps
sVel = sLowVol + (sIncr * i)

arr.Add(New ComfortResults(sVel, 1, 1, 1, 1))
Next i

RepList.DataSource = arr
RepList.DataBind()

End Sub