Toggle visibility of specific elements in a ListView
<p>I have a list view on a page and am trying emulate the toggling effect of a tree view. When first bound the detail elements (LBL_ActionTitle, LBL_Action, LBL_UrlTitle, LBL_Url) are set to visibility = false. I would like to have the click event of the element (LB_ExpandCollapse) toggle the visibility of detail elements directly related to it. IE not all the elements of that type on the page. I am not sure how to accomplish this, or if it can be done, and was hoping that someone could point me in the right direction. Here is the control for reference. </p>

<pre><code>    &lt;div id="logContainer"&gt;
        &lt;asp:ListView ID=LV_Logs runat="server"&gt;
            &lt;LayoutTemplate&gt;
                &lt;table border="0" cellpadding="0" cellspacing="0" style="width:100%"&gt;
                    &lt;tr&gt;
                        &lt;td&gt;&lt;/td&gt;
                        &lt;td style="width:85%" /&gt;
                    &lt;/tr&gt;
                    &lt;asp:PlaceHolder ID="itemPlaceholder" runat="server" /&gt;
                &lt;/table&gt;
            &lt;/LayoutTemplate&gt;
            &lt;ItemTemplate&gt;
                &lt;tr&gt;
                    &lt;td&gt;
                        &lt;hr /&gt;
                        &lt;asp:LinkButton ID="LB_ExpandCollapse" runat="server" CausesValidation="false" OnClick="expandCollapse_Click"&gt;+&lt;/asp:LinkButton&gt;
                        &lt;asp:Label ID="LBL_MessageType" runat="server" Text='&lt;%# Eval("messageType") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;hr /&gt;
                    &lt;/td&gt;
                    &lt;td style="text-align: right"&gt;
                        &lt;hr /&gt;
                        &lt;asp:Label ID="LBL_Message" runat="server" Text='&lt;%# Eval("messageTime") %&gt;'&gt;&lt;/asp:Label&gt;
                        &lt;hr /&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;

                &lt;tr style="text-align: left"&gt;
                    &lt;td style="padding-left: 65px"&gt;
                        &lt;asp:Label ID="LBL_ActionTitle" Visibility="false" runat="server" Text="User Action:"&gt;&lt;/asp:Label&gt;
                    &lt;/td&gt;
                    &lt;td style="padding-left: 10px"&gt;
                        &lt;asp:Label ID="LBL_Action" Visibility="false" runat="server" Text='&lt;%# Eval("action") %&gt;'&gt;&lt;/asp:Label&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr style="text-align: left"&gt;
                    &lt;td style="padding-left: 65px"&gt;
                        &lt;asp:Label ID="LBL_UrlTitle" Visibility="false" runat="server" Text="URL:"&gt;&lt;/asp:Label&gt;
                    &lt;/td&gt;
                    &lt;td style="padding-left: 10px"&gt;
                        &lt;asp:Label ID="LBL_Url" runat="server" Visibility="false" Text='&lt;%# Eval("url") %&gt;'&gt;&lt;/asp:Label&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;

           &lt;/ItemTemplate&gt;

        &lt;/asp:ListView&gt;
        &lt;asp:DataPager ID="DataPagerProducts" runat="server" PagedControlID="LV_Logs"
            PageSize="20" OnPreRender="DataPagerProducts_PreRender"&gt;
            &lt;Fields&gt;
                &lt;asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False" /&gt;
                &lt;asp:NumericPagerField /&gt;
                &lt;asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False" /&gt;
            &lt;/Fields&gt;
        &lt;/asp:DataPager&gt;
</code></pre>
