I'm trying to do a simple show/hide: when you click on a category, it's corresponding products appear below it. Click the category again, and the menu folds back up.
What's happening now is that when I click on an item in dlCategories, it's corresponding dlProduct appears for a second, but then I guess it goes back to the server which causes the products to disappear again...(didn't make sense did it?)
Any ideas???
I don't think I need to show my javascript here: I'm pretty sure it works, as I've used it outside of .Net countless of times. If you want to see it, I'll post it.
I've added the javascript call like this, which works to a degree:
Here are my nested datalists: (not sure why it doesnt display nicely formatted..sorry)
Thanks for any tips!
What's happening now is that when I click on an item in dlCategories, it's corresponding dlProduct appears for a second, but then I guess it goes back to the server which causes the products to disappear again...(didn't make sense did it?)
Any ideas???
I don't think I need to show my javascript here: I'm pretty sure it works, as I've used it outside of .Net countless of times. If you want to see it, I'll post it.
I've added the javascript call like this, which works to a degree:
Code:
objButton.Attributes.Add("onclick", "javascript: show('products');")
Here are my nested datalists: (not sure why it doesnt display nicely formatted..sorry)
Code:
<!-- Begin Category Listing -->
<asp:datalist id="dlCategories" runat="server">
<ItemTemplate>
<P class="wht_11" style="MARGIN: 0px 18px 8px 0px"><b>
<asp:LinkButton id="Linkbutton1" Runat="server" CommandArgument='<%# Container.DataItem("categoryID") %>' CommandName="Edit">
<%#Container.DataItem("CategoryName")%>
</asp:LinkButton></b></P>
<!-- Begin Product Listing -->
<td id="products" style="display: none'" runat=server>
<asp:DataList ID="dlProd" Runat="server">
<ItemTemplate>
<P class="wht_11" style="MARGIN: 0px 18px 8px 0px">
<asp:LinkButton id="linkButton2" Runat="server" OnClick="ProductDetailClicked" CommandArgument='<%# Container.DataItem("productsID") %>'>
<%#Container.DataItem("ProductName")%>
</asp:LinkButton></P>
</ItemTemplate>
</asp:DataList>
</td>
<!-- End Product Listing -->
</ItemTemplate>
</asp:datalist>
<!-- End Category Listing -->
Thanks for any tips!