Here is the ListView I have for the products page:
<asp:ListView ID="list_view" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<table class="single_product">
<tr>
<td>
<img src="<%# Eval("image") %>" />
</td>
<td>
<asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
</td>
<td>
<asp:Label ID="descriptionLabel" runat="server" Text='<%# Eval("description") %>' />
</td>
<td>
<form action="comments.aspx" method="post">
<input type="hidden" name="prod_id" value="<%# Eval("prod_id") %>">
<input type="submit" name="prod_submit" class="button" value="View Comments">
</form>
</td>
</tr>
</table>
</ItemTemplate>
</asp:ListView>
The user can view the comments for a certain product by clicking the button, taking the prod_id over to the comments page.
Now here is the datasource for the comments page:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:username %>"
ProviderName="<%$ ConnectionStrings:username.ProviderName %>"
InsertCommand="INSERT INTO comment (prod_id, comment_desc, username) VALUES (@prod_id, @comment_desc, @username)"
SelectCommand="SELECT * FROM comment WHERE prod_id = prod_id ORDER BY comment_date DESC">
<InsertParameters>
<asp:Parameter Name="prod_id" Type="Int32" DefaultValue="2" />
<asp:Parameter Name="comment_desc" Type="String"/>
<asp:Parameter Name="username" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
I want the select to be like this:
SelectCommand="SELECT * FROM comment WHERE prod_id = [value from previous page] ORDER BY comment_date DESC"
I have used Request.Form, etc. but no luck.
I also have other problems but I'll mention them once/if this is solved.
Thank you for any responses.