|
-
Dec 30th, 2012, 09:36 AM
#1
Thread Starter
Addicted Member
Master-detail pages for products
Hello,
I have a page for products which links to another page for a more detailed page for a specific product the user selects.
In design view, I've attached a objectdatasource and datalist in design view on the detailed page. Sonething like this:
Code:
<asp:DataList ID="DataList1" runat="server" DataSourceID="ObjectDataSource1">
<ItemTemplate>
<div class="productDetail">
<img src="<%=ResolveClientUrl("~/images/")%><%#Eval("LargeImage")%>" />
<div>
<h1><%#Eval("Name")%></h1>
<p><%#Eval("Description")%></p>
<span>£<%#Eval("Price")%></span><asp:RadioButton ID="standardDeliveryRb" runat="server" GroupName="deliveryGroup" Checked="true" Text=" Standard Delivery - £4.99" />
<br />
<br />
<asp:RadioButton ID="NextDayDeliveryRb" GroupName="deliveryGroup" runat="server" Text=" Next Day Delivery - £7.99" />
<br />
<br />
<br />
<asp:Button
ID="addToCartBtn"
runat="server"
Text="Add to Cart"
OnClick="addToCartBtn_Click" />
</div>
</div>
</ItemTemplate>
</asp:DataList>
Obviously, as its the detail view I only want a single record so a list type control is too much but I couldn't find an alternative, is there one?
Also, when the user clicks on a button I want it to redirect to a page and pass the productId in the url header. How can I access the datasource from the code behind, the way it's done using eval on the front end without running another database query.
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|