Untitled


SUBMITTED BY: Guest

DATE: April 18, 2014, 7:21 p.m.

FORMAT: HTML

SIZE: 2.3 kB

HITS: 865

  1. //CART.ASPX
  2. //Declaring where the data will be taken from (datasource)
  3. <asp:AccessDataSource
  4. id="CartAccessDataSource"
  5. DataFile="~/App_Data/UserDB.accdb"
  6. runat="server"
  7. SelectCommand="SELECT bookName, quantity, price, orderId FROM cart"
  8. />
  9. //actually doing the gridview
  10. <asp:GridView
  11. id="CartsGridView"
  12. runat="server" DataSourceID="CartAccessDataSource"
  13. onrowdatabound="CartsGridView_RowDataBound" CellPadding="4" ForeColor="#333333"
  14. GridLines="None" >
  15. <AlternatingRowStyle BackColor="White" />
  16. //Only declaring one column here because the rest are auto-generated
  17. <Columns>
  18. <asp:TemplateField HeaderText="Shopping Cart" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" ShowHeader="false" HeaderStyle-Height="40px">
  19. <ItemTemplate>
  20. <asp:LinkButton ID="Remove" Text="Remove" OnClick="RemoveFromCart" CommandArgument='<%# Eval("orderId") %>' CommandName="RemoveFromCart" runat="server"></asp:LinkButton>
  21. </ItemTemplate>
  22. <HeaderStyle Height="40px" CssClass="leftborder"></HeaderStyle>
  23. <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="33px"></ItemStyle>
  24. </asp:TemplateField>
  25. </Columns>
  26. //style
  27. <EditRowStyle BackColor="#2461BF" />
  28. <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  29. <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  30. <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
  31. <RowStyle BackColor="#EFF3FB" />
  32. <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
  33. <SortedAscendingCellStyle BackColor="#F5F7FB" />
  34. <SortedAscendingHeaderStyle BackColor="#6D95E1" />
  35. <SortedDescendingCellStyle BackColor="#E9EBEF" />
  36. <SortedDescendingHeaderStyle BackColor="#4870BE" />
  37. </asp:GridView>

comments powered by Disqus