Google Checkout buttons in ASPX Gridview

Hi

I have a web page which has a dynamically built gridview with items for sale and their description etc on each row. At the end i want to use a google checkout button to enable users to purchase the items. However i seem to be running into diffuclties with the generated code google creates for the button and my own code. I have attached code below which shows the datagird view in the asp page with the google button as it is now. (I have changed the merchantID). on the page this is displayed i get two results (two lines) if i click the first line button i get an error message... Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

when i click the second line item button it works fine...

whats going on - can you help...
ps. i have enabled event validation on my page.

<asp:GridView ID="dvTests" runat="server" AutoGenerateColumns="False" Width="560px">
                     <Columns>
                         <asp:TemplateField HeaderText="Test Name">
                             <ItemTemplate>
                                 <asp:Label ID="lblQuizName" runat="server" Text='<%# Eval("QuizName") %>'></asp:Label>
                             </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="Type">
                             <ItemTemplate>
                                 <asp:Label ID="lblType" runat="server" Text='<%# Eval("Category") %>'></asp:Label>
                             </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="Expiry">
                             <ItemTemplate>
                                  <span id=Expiry runat="server">
                                  <asp:Label ID="lblDate" runat="server" Text='<%# Eval("ExpirationDate", "{0:dd/MM/yyyy}") %>'></asp:Label>
                            </span>
                            </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="Path" Visible="False">
                             <ItemTemplate>
                                  <asp:Label ID="lblPath" runat="server" Text='<%# Eval("FilePath") %>'></asp:Label>
                             </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField >
                   <ItemTemplate> 
            <form action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/448140563247512" id='<%# Eval("QuizName") %>' method="post" name='<%# Eval("QuizName") %>'>
                <input name="item_name_1" type="hidden" value='<%# Eval("QuizName") %>'/>
                <input name="item_description_1" type="hidden" value='<%# Eval("QuizName") %>'/>
                <input name="item_quantity_1" type="hidden" value="1"/>
                <input name="item_price_1" type="hidden" value='<%# Eval("Price") %>'/>
                <input name="item_currency_1" type="hidden" value="GBP"/>
                <input name="_charset_" type="hidden" value="utf-8"/>
                <input name='<%# Eval("QuizName") %>' alt="" src="https://checkout.google.com/buttons/buy.gif?merchant_id=448140563247512&amp;w=121&amp;h=44&amp;style=white&amp;variant=text&amp;loc=en_UK" type="image"/>
             </form>
                 </ItemTemplate> 
                  </asp:TemplateField>
                 </Columns>
                 </asp:GridView>

Open in new window

kingkev83Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gyanendra SinghArchitectCommented:
no this is not correct way .. you need to put only button in gridview ... and need to handle button click event .... and on that event pass all the information

this would be like that
<asp:imagebutton id="btnSubmitPaypal" runat="server" imageurl="/images/google.gif" alternatetext="Purchase Using google checkout" postbackurl="https://checkout.google.com/cws/v2/Merchant/[your merchant number]/checkoutForm" />

refer this artical for details
http://dotnetdiscussion.net/2008/02/27/aspnet-how-to-integrate-both-google-checkout-and-paypal-in-3-steps/
0
kingkev83Author Commented:
How do I pass the information for each button click - each row will have different information.. I have tried this web site but im not sure where to call the  createcheckoutTag function and where i need to return to.. can you provide some code to help me along with this
 
0
Gyanendra SinghArchitectCommented:
see on click of that button you will get selected row  event in grid event ... use that event ... and get the value from selected cell .. thats it
0
kingkev83Author Commented:
ON Click of that button gives me a button click event not a grid event.
Is there any way of doing this in javascript?  what I have running at the momnent is:

javascript: function Navigate(Location)
{
alert("You are now entering a secure site for payment")
javascript:window.open(Location);
}

ASP:
   <asp:TemplateField >
                   <ItemTemplate>
                          <asp:ImageButton OnClientClick="Navigate('https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/448140563247566')" ImageUrl="https://checkout.google.com/buttons/buy.gif?merchant_id=448140563247566&w=121&h=44&style=white&variant=text&loc=en_US" ID="Button" runat="server" />          
                  </ItemTemplate>
                  </asp:TemplateField>
I need to be able to pass the input parameters as well as the URL into the javascript to send the user to the right page - currently i get a whoops page with google
0
kingkev83Author Commented:
I have managed to make a work around, I have used the google checkout which uses a javabased checkout system. It done the trick..
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
E-Commerce

From novice to tech pro — start learning today.