code behind code doesnt work
i have created a seperate file to put some code behind code in in asp.net with vb application.
however, when i run my code it doesnt work, there are 3 errors which occur.
the first being it says the first line a declaration is expected, in lines 2 and 4 it says the stament is not in a valid namespace and finally, it says for the last line that the end class must be preceeded by a matching class. i have pasted my code underneath, can someone please advise me, especially about the namespace bit. i run my application locally, i do not have a web server, do you think this is causing any problems?
Partial Class WebApplication3.WebForm1
Inherits System.Web.UI.Page
Sub Calculation(ByVal Src As Object, ByVal Args As EventArgs)
Dim cost As Double
Dim total As Double
Dim quantity As Double
If (FruitDropDown.SelectedValue = "Apples") Then
cost = 2
End If
If (FruitDropDown.SelectedValue = "Bananas") Then
cost = 3
End If
If (FruitDropDown.SelectedValue = "Cherries") Then
cost = 5
End If
quantity = CDbl(TextBox.Text)
total = cost * quantity
CostCalculationLabel.Text = quantity.ToString + " " + FruitDropDown.SelectedValue + " will cost " + total.ToString
End Sub
End Class
|