Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a grid view. I wanted to do payment using the grid view. When I click on check out button. It would retrieve all items in the grid view and send to the paypal site. But currently it is not working. Anyone know how to do, I would be greatly appreciated.

My grid view code:
XML
<asp:GridView ID="gv_CartProduct" runat="server" AutoGenerateColumns="False" onRowCommand="gv_CartProduct_OnRowCommand">
  <Columns>
  <asp:TemplateField HeaderText="Title">
      <ItemTemplate>
          <asp:Label ID="lbl_title" Text='<%# Eval("title") %>' runat="server"></asp:Label>
      </ItemTemplate>
  </asp:TemplateField>
     <asp:TemplateField HeaderText="Image">
              <ItemTemplate>
                  <asp:Image ID="imgPreview" ImageUrl='<%# Eval("image")  %>' runat="server"
                      Height="80px" Width="80px" />
              </ItemTemplate>
          </asp:TemplateField>

  <asp:BoundField DataField="price" HeaderText="Price" />
 <asp:TemplateField HeaderText="Quantity">
 <ItemTemplate>
      <asp:TextBox ID="tb_quantity" runat="server"  CommandArgument='<%# Eval("title")%>' Text='<%# Eval("qty") %>' ></asp:TextBox>
  </ItemTemplate>
   </asp:TemplateField>
  <asp:TemplateField>
  <ItemTemplate>
  <asp:LinkButton ID="btn_delete" runat="server" Text="Delete" CommandName="deleterow" CommandArgument='<%# Eval("title") %>' OnClientClick="return confirm('Do you want to delete product?');"  ></asp:LinkButton>
  </ItemTemplate>
  </asp:TemplateField>
</Columns>
  </asp:GridView>


My paypal button code:
<asp:Button ID="btn_Checkout" runat="server" Text="Checkout" OnClick="btn_Checkout_Click" />


Code behind for btn_Checkout:
C#
protected void btn_Checkout_Click(object sender, EventArgs e)
        {
           //PAYPAL CODE HERE
        }


Currently I have removed the code behind for checkout button as it has been giving me errors. Please help!:D
Posted
Updated 27-Dec-14 17:06pm
v2
Comments
Homero Rivera 27-Dec-14 23:15pm    
What error are you getting? Where is the browser going to after submit? I was under the implression Paypal was to work only on the client-side, but maybe Im worong... A description of the error will be a good starting point.
Member 11237565 28-Dec-14 2:43am    
It is not parsing any value from the grid view to the PayPal!
Homero Rivera 28-Dec-14 11:09am    
https://developer.paypal.com/docs/

1 solution

Never, ever, accept code from a insecure website to handle anything to do with real money.
You do not know who is giving you the code, you do not know what it does, you do not know that it places the monies correctly into the appropriate account, without passing the details to any third parties.

Only get such code from reputable card transaction service companies - the scope for fraud otherwise is far too large. And remember, you personally could be liable for any monies lost if your action is seen to be negligent - which getting your code from a public forum would most certainly be!
 
Share this answer
 
Comments
Member 11237565 28-Dec-14 9:14am    
No, I am trying to implement a Buy Now PayPal button onto my own website.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900