更新:对不起-我是个傻瓜。显示:块保留在div的样式中。
我有一个ASP.Net页面,在该页面中,我构建了一个应该显示为手风琴的HTML。这是可行的,但页面呈现手风琴与所有面板展开。
在编写HTML之后,我是否可以将面板重置为所有折叠的面板?
System.Text.StringBuilder b = new System.Text.StringBuilder();
Condition[] conditions = SearchConditions(searchFor.Text);
b.Append("<div id=\"ac1\" class=\"accordion\">");
foreach (Condition c in conditions)
{
b.Append(" <h2>" + c.ConditionName + "<br /><span style=\"font-size:x-small\">" + c.Information + "</span></h2>" + Environment.NewLine) ;
b.Append(" <div class=\"pane\" style=\"display:block; font-size:x-small\">" + Environment.NewLine);
b.Append(" " + c.ConditionDescription + " <br /><br />" + Environment.NewLine);
if (c.ConditionInstructions.Length > 0)
{
b.Append(" <div class=\"message error\">");
b.Append(" <strong>Important:</strong><br />");
b.Append(" " + c.ConditionInstructions + "");
b.Append(" </div>");
b.Append(" <br />");
}
b.Append(" <a href=\"#\">Add Condition</a>" + Environment.NewLine);
b.Append(" </div>" + Environment.NewLine);
}
b.Append("</div>");
searchResults.Text = b.ToString();searchResults.Text是页上的ASP:文字控件。
发布于 2012-01-12 15:59:34
如果没有正确导入手风琴的jquery/css,则可能会发生这种情况。验证一下,您是否在页面中包含了jquery手风琴脚本和css。
https://stackoverflow.com/questions/8838027
复制相似问题