- Total Members: 220,010
- Threads: 525,381
- Posts: 976,975
-
November 13th, 2012, 02:21 PM
#1
Promo Code
I am trying to add a promo code to my website that will allow the input of a promo code and give the client an additional 5% discount. This is the code that I have:
Dim Promo as String, formval
Promo = "BNOV21"
formval = request.form("discount")
lblTotal.Text = GetItemTotal()
If (formval = Promo) and (session("discount") = "") Then
GetItemTotal() = GetItemTotal() - (GetItemTotal() * .05)
session("discount") = GetItemTotal()
end if
lblTotal0.Text = RetailShip
lblTotal1.Text = RetailShip + GetItemTotal()
Itemlbl.Text = RetailShip
If session("discount") <> then GetItemTotal() = session("discount")
If objDT.Rows.Count = 0 Then
lblTotal0.Text = "0.00"
lblTotal1.Text = "0.00"
This is the error I get:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30068: Expression is a value and therefore cannot be the target of an assignment.
Source Error:
Line 412: lblTotal.Text = GetItemTotal()
Line 413: If (formval = Promo) and (session("discount") = "") Then
Line 414: GetItemTotal() = GetItemTotal() - (GetItemTotal() * .05)
Line 415: session("discount") = GetItemTotal()
Line 416: end if
Can someone help me?
Thanks,
Dave
-
November 21st, 2012, 12:58 PM
#2
Line 414: GetItemTotal() = GetItemTotal() - (GetItemTotal() * .05)
GetItemTotal() appears to be a function or method. You can't assign a value to that type of object. If GetItemTotal() returns a double, then you could have something like:
dblItemTotal = GetItemTotal() - (GetItemTotal() * .05)
Roger (.NET MCP)
Similar Threads
-
By captain15 in forum ASP Development
Replies: 12
Last Post: November 16th, 2012, 01:26 PM
-
By chanelc707 in forum Windows Web Hosting
Replies: 0
Last Post: September 4th, 2012, 06:37 PM
-
By badmp3 in forum ASP Development
Replies: 1
Last Post: December 20th, 2009, 06:04 AM
-
By kabucek in forum Microsoft SQL Server
Replies: 1
Last Post: May 9th, 2009, 08:52 PM
-
By RSS_News_User in forum Business News
Replies: 0
Last Post: November 23rd, 2005, 06:05 AM