Have to click button twice... wth?!

Z

Zamael

Okay... I've got a web app built in .NET 2.0 and for some reason I have
to click a LinkButton twice in order for it to work.

What's interesting is that the first URL reads as follows:
javascript:__doPostBack('ctl00$ContentPlaceHolder1$lnkbCheckout','')

But after it is clicked once it changes to:
javascript:WebForm_DoPostBackWithOptions(new
WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$lnkbCheckout", "",
false, "",
"https://www.paypal.com/cart/&busine...ity_1=1&amount_1=1320.00&handling_cart=329.59",
false, true))



Here's the code that creates/assigns the URL to the button:

Private Sub btnCheckOut_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lnkbCheckout.Click

strZipCode = tbxZipCode_low.Text
If strZipCode = String.Empty Then
lblZipError.Text = "-> Required"
ElseIf strZipCode.Length > 5 Then
lblZipError.Text = "-> Incorrect"
ElseIf strShipping = "0.0" Then
lblZipError.Text = "-> Required"
Else
Dim strMax As String = "Max Industrial -- Shopping Cart"
Dim da As New Ecomm.DataAccess
Dim ds As New Data.DataSet
ds = da.DataReturn("select * from ShoppingCart Where
OrderNumber = '" & Session("OrderNumber") & "' select * from Shipping
Where OrderNumber = '" & Session("OrderNumber") & "'")
ds.Tables(0).TableName = "ShoppingCart"
ds.Tables(1).TableName = "Shipping"

Dim sbURL As New StringBuilder

sbURL.Append("https://www.paypal.com/cart/&[email protected]&upload=1&")
Dim i As Integer = 0
Dim dr As Data.DataRow
For Each dr In ds.Tables("ShoppingCart").Rows
i += 1
sbURL.Append("item_name_" & i & "=")
sbURL.Append(dr.Item("ProductPartNum"))
sbURL.Append("&")
sbURL.Append("quantity_" & i & "=")
sbURL.Append(dr.Item("ProductQty"))
sbURL.Append("&")
sbURL.Append("amount_" & i & "=")
sbURL.Append(FormatNumber(dr.Item("ProductPrice"), 2,
TriState.False, TriState.False, TriState.False))
sbURL.Append("&")
Next
sbURL.Append("handling_cart=" &
ds.Tables("Shipping").Rows(0).Item("ShippingEstimate"))
Dim strURL As String = sbURL.ToString
lnkbCheckout.PostBackUrl = strURL
End If
End Sub
 
Z

Zamael

Never mind; I fixed it. I had to add the URL creation/assign function
to the Page_Load event so that each time the page refreshed the URL
would recreate and be reassigned.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top