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:
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?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>
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




Reply With Quote