i am working on Shopping cart
in the AddToCart function
at this line >>> cost1 = Decimal.Parse(ddlProducts.SelectedItem.Value)
there is an error
this is the error message
Input string was not in a correct format.
Sub AddToCart(s As Object, e As EventArgs)
objDT = Session("Cart")
Dim Product = ddlProducts.SelectedItem.Text
Dim blnMatch As Boolean = False
For Each objDR In objDT.Rows
If objDR("Product") = Product Then
objDR("Quantity") += txtQuantity.Text
blnMatch = True
Exit For
End If
Next
If Not blnMatch Then
objDR = objDT.NewRow
objDR("Quantity") = txtQuantity.Text
objDR("Product") = ddlProducts.SelectedItem.Text
Dim cost1
cost1 = Decimal.Parse(ddlProducts.SelectedItem.Value)
MsgBox(cost1)
objDR("Cost") = cost1
objDT.Rows.Add(objDR)
End If
Session("Cart") = objDT
dg.DataSource = objDT
dg.DataBind()
lblTotal.Text = "$" & GetItemTotal()
End Sub
need help plz :icon_sad: