I have a user control that is attempting to be used as the BuyNow page for PayPal. I am aware of the issues that are around with the PayPal buttons being inside nested forms in relation to ASP.NET. I know that I could simply use the link with the relevant data to send to PayPal using the buttons PostbackURL property, but the issue is that these are effectively donations and the client wishes to include a dropdown/select with Gift Aid/Without Gift Aid options to be selected. If you create the button on PayPal, using a select does not allow the option of sending by email/link. There is the added complication that they have 4 buttons for the various donation values they want to have, each
I thought I could write the user control to trap the postback event from the button click and redirect to paypal with a complete URL including the giftaid selection. However, I cannot seem to get the page to acknowledge the post back event at all.
Here is the code for the image button on the .ascx page:
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { lblMessage.Text = "I have posted back"; } else { lblMessage.Text = "I have not posted back"; } }
As you can see, there is really nothing to it, but I cannot for the life of me get the lblmessage to say 'I have posted Back"!!!!!!
I'm sure it is something really simple that is doing this, but I can't see what it is.
The user control is on a template that has 3 parent templates above it - so in effect it is the 4th child page.
Yeah, that was the first thing I checked and it definetely has the form tag round the whole thing. I have also doubled checked that there are not other forms hiding in the page elsewhere.
User Control not posting back?
I have a user control that is attempting to be used as the BuyNow page for PayPal. I am aware of the issues that are around with the PayPal buttons being inside nested forms in relation to ASP.NET. I know that I could simply use the link with the relevant data to send to PayPal using the buttons PostbackURL property, but the issue is that these are effectively donations and the client wishes to include a dropdown/select with Gift Aid/Without Gift Aid options to be selected. If you create the button on PayPal, using a select does not allow the option of sending by email/link. There is the added complication that they have 4 buttons for the various donation values they want to have, each
I thought I could write the user control to trap the postback event from the button click and redirect to paypal with a complete URL including the giftaid selection. However, I cannot seem to get the page to acknowledge the post back event at all.
Here is the code for the image button on the .ascx page:
And here is the Page_Load code:
As you can see, there is really nothing to it, but I cannot for the life of me get the lblmessage to say 'I have posted Back"!!!!!!
I'm sure it is something really simple that is doing this, but I can't see what it is.
The user control is on a template that has 3 parent templates above it - so in effect it is the 4th child page.
Any ideas what I am doing wrong?
Regards
Iain
Hi Iain,
Make sure your macro is wrapped in <form runat="server"> tag in your template, ie:
-Tom
Yeah, that was the first thing I checked and it definetely has the form tag round the whole thing. I have also doubled checked that there are not other forms hiding in the page elsewhere.
this
.Page.ClientScript.GetPostBackEventReference(this, "NEXT")If the Javascript code is not in your - Get anything like this in your code, this will register the postback javascript code :-)
If the postback javascript can be found, check the validation on the page.
A decent message editor in this forum ??? When ?
is working on a reply...