User-559866590 posted
Hi,
I am developing a Visual C# and ASP.NET E-commerce web application. I have used a Datalist to populate information from my SQL database within Visual Studio.
I only want to display specific products on a new page after the button (btnAddToBasket) has been clicked.
For example, on my PlayStation web page, if the user clicks the button under the first product, then I only want the title, image, and price to be displayed on a new page for that specific product.
Here is the ASP.NET code I have used for my data List:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [Title], [ProductImage], [Price] FROM [PRODUCT] WHERE (([Console] = @Console) AND ([ProductType] = @ProductType))">
<SelectParameters>
<asp:Parameter DefaultValue="PlayStation 4" Name="Console" Type="String" />
<asp:Parameter DefaultValue="Video Game" Name="ProductType" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" RepeatColumns="2" RepeatDirection="Horizontal" Font-Bold="True" Font-Size="Large">
<ItemTemplate>
<div class="auto-style1" style="text-align: center; padding: 20px;">
<asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
<br />
<asp:Image ID="Image3" runat="server" Height="200px" ImageUrl='<%# Eval("ProductImage") %>' Width="150px" />
<br />
£<asp:Label ID="PriceLabel" runat="server" Text='<%# Eval("Price") %>' />
<br />
<br />
<asp:ImageButton ID="btnAddToBasket" runat="server" ImageUrl="~/images/shopping_basket_logo.jpg" />
<br />
<br />
</div>
</ItemTemplate>
</asp:DataList>
Does anyone have any suggestions on how I could resolve this issue?
Kind Regards,
Jonathan