G
Guest
I hope someone can help with this, because it’s driving me crazy. It’s also
a little tough to describe what’s happening, but I’ll do my best.
I have a class that takes a ProductID and then uses it to generate some
html. I then insert that HTML into my page via server tags. I’m using a
datalist for the content, making a 3 x 3 grid.
For each instance of my ItemTemplate, I’m changing a pic, some text, a link
button, and my class-generated html. The first three change for each new
ProductID. However, the stuff between the server tags appears to be running
only after the entire page is rendered, meaning that my class is called nine
times with the same ProductID.
I’ve included below the code that I think must contain the problem. The
class does it’s job fine. The ProductID is also changing in
list_ItemDataBound(). I can post the class too if it’ll be helpful, but this
post is already getting long.
Thanks for any help.
-Josh Nikle
// Snip from my aspx page
…<asp:LinkButton ID="addToCartButton" runat="server" Text="Buy now!"
CommandArgument='<%# Eval("ProductID") %>'></asp:LinkButton> | <a
href='Product.aspx?ProductID= <%# Eval("ProductID")
%>'>Info</a></font></strong>
</td>
</tr>
<tr height=14 width="100%">
<td align="center" valign="middle" colspan=2 class="SectionHeader">
<%
prodID = productID;
catBrowse = new BrowseCategory(prodID);
Response.Write(catBrowse.browseCategoryHTML());
%>
</td>
</tr>…
// My variable list at the top of the aspx.cs file
protected BrowseCategory catBrowse;
protected int prodID;
protected int productID;
// Gets the ProductID to pass to the BrowseCategory class
protected void list_ItemDataBound(object sender, DataListItemEventArgs e)
{
productID = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem,
"ProductID"));
}
a little tough to describe what’s happening, but I’ll do my best.
I have a class that takes a ProductID and then uses it to generate some
html. I then insert that HTML into my page via server tags. I’m using a
datalist for the content, making a 3 x 3 grid.
For each instance of my ItemTemplate, I’m changing a pic, some text, a link
button, and my class-generated html. The first three change for each new
ProductID. However, the stuff between the server tags appears to be running
only after the entire page is rendered, meaning that my class is called nine
times with the same ProductID.
I’ve included below the code that I think must contain the problem. The
class does it’s job fine. The ProductID is also changing in
list_ItemDataBound(). I can post the class too if it’ll be helpful, but this
post is already getting long.
Thanks for any help.
-Josh Nikle
// Snip from my aspx page
…<asp:LinkButton ID="addToCartButton" runat="server" Text="Buy now!"
CommandArgument='<%# Eval("ProductID") %>'></asp:LinkButton> | <a
href='Product.aspx?ProductID= <%# Eval("ProductID")
%>'>Info</a></font></strong>
</td>
</tr>
<tr height=14 width="100%">
<td align="center" valign="middle" colspan=2 class="SectionHeader">
<%
prodID = productID;
catBrowse = new BrowseCategory(prodID);
Response.Write(catBrowse.browseCategoryHTML());
%>
</td>
</tr>…
// My variable list at the top of the aspx.cs file
protected BrowseCategory catBrowse;
protected int prodID;
protected int productID;
// Gets the ProductID to pass to the BrowseCategory class
protected void list_ItemDataBound(object sender, DataListItemEventArgs e)
{
productID = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem,
"ProductID"));
}