Need Assistance with Collapsible Content (C#)
-
Hello, I have a web page (in C#) that stores news and events. The data (news and events) is categorized by month. When the user visits the page, I would like to display the content of the existing month only. For example, the user will see. August event 1 news 2 July June May April I would like the user to be able to click on any other month to display the content of that respective month. Ideally, only one month should be expanded at a time (however this is not imperative). Any help or assistance would be appreciated. If you need more information please let me know. Thank you, Allison
-
Hello, I have a web page (in C#) that stores news and events. The data (news and events) is categorized by month. When the user visits the page, I would like to display the content of the existing month only. For example, the user will see. August event 1 news 2 July June May April I would like the user to be able to click on any other month to display the content of that respective month. Ideally, only one month should be expanded at a time (however this is not imperative). Any help or assistance would be appreciated. If you need more information please let me know. Thank you, Allison
why dont you use Javascript to display / hide content. Say you have used the html code block as below :
<div onclick="javascript:expandCollapsePane(this, 'dvContainer');">
August
</div>
<div id="dvContainer">
Event 1
News 2
</div>Now when user clicks on the Div Pane named august you can make the container div visible true or false :
function expandCollapsePane(obj, pane) {
var containerPane = document.getElementByID(pane);
var isCollapsed = (containerPane.style.display == 'none');
if (isCollapsed) {
containerPane.style.display = 'block';
}
else {
containerPane.style.display = 'none';
}
}The javascript just hides the dvContainer on click. To make all of them invisible when one is open, just create an array of all such elements you create and before expanding anyone of them do a for loop and hide each other element in the block. Hope you understand. :thumbsup::rose:
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.