<div class='section_divider'> <table width='100%' border='0' cellpadding='0' cellspacing='0'> <tr> <td class='section_title' style='width: 363px'>" + this.XPandoTitle + "</td> <td class='section_updatedby'>" + DateTime.Now + "</td> <td class='section_expand'><img onclick= expandcontent('"+ this.XPandoID + "'); style='WIDTH:100%;cursor:hand; cursor:pointer' alt='collopse' src='Images/section_collapse_off.gif' width='29' height='29'/></td> </tr> </table> </div> <div id='" + this.XPandoID + "'class='switchcontent'> <table width='70%' border='0' cellpadding='0' cellspacing='0' class='menutable_outline'> <tr> </tr> </table> </div>
style="display:none"
<div id="whatever" style="display:none">Some content here...</div>
<script type="text/javascript"> function Visibility(id) { if (document.getElementById(id).style.display == 'none') { document.getElementById(id).style.display = 'block'; } else { document.getElementById(id).style.display = 'none'; } } </script>
<a href="#" onClick="Visibility('whatever');">Show div, hide div</a>
//html <div class='section_divider'> <table width='100%' border='0' cellpadding='0' cellspacing='0'> <tr> <td class='section_title' style='width: 363px'>this.XPandoTitle</td> <td class='section_updatedby'> DateTime.Now</td> <td class='section_expand'><img onclick="expandContent('XPandoID');" style='WIDTH:100%;cursor:hand; cursor:pointer' alt='collopse' src='Images/section_collapse_off.gif' width='29' height='29'/></td> </tr> </table> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" /></div> <div id='XPandoID' style="display:none" class='switchcontent'> <table width='70%' border='0' cellpadding='0' cellspacing='0' class='menutable_outline'> <tr> </tr> </table> </div> /js function expandContent(id) { alert(id); if (document.getElementById(id).style.display == 'none') { document.getElementById(id).style.display = 'block'; } else { document.getElementById(id).style.display = 'none'; } }
<script type="text/javascript"> function expandContent(id) { if (document.getElementById(id).style.display == 'none') { document.getElementById(id).style.display = 'block'; } else { document.getElementById(id).style.display = 'none'; } } </script> <div class='section_divider'> <table width='100%' border='0' cellpadding='0' cellspacing='0'> <tr> <td class='section_title' style='width: 363px'>this.XPandoTitle</td> <td class='section_updatedby'> DateTime.Now</td> <td class='section_expand'><img onclick="expandContent('XPandoID');" style='WIDTH:100%;cursor:hand; cursorointer' alt='collopse' src='Images/section_collapse_off.gif' width='29' height='29'/></td> </tr> </table> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" /></div> <div id='XPandoID' style="display:none" class='switchcontent'> <table width='70%' border='0' cellpadding='0' cellspacing='0' class='menutable_outline'> <tr> <td>Test content here.... </td> </tr> </table> </div>
// protected override void RenderContents(HtmlTextWriter o) { StringBuilder sb = new StringBuilder(); sb.Append(" <div class='section_divider'> "); sb.Append(" <table width='100%' border='0' cellpadding='0' cellspacing='0'>"); sb.Append(" <tr>"); sb.Append(" <td class='section_title' style='width: 363px'>" + this.XPandoTitle + "</td> "); sb.Append(" <td class='section_updatedby'>" + DateTime.Now + "</td>"); sb.Append(" <td class='section_expand'><img onclick= expandContent('"+ this.XPandoID + "'); style='WIDTH:100%;cursor:hand; cursor:pointer' alt='collopse' src='Images/section_collapse_off.gif' width='29' height='29'/></td>"); sb.Append(" </tr>"); sb.Append(" </table>"); sb.Append(" </div>"); sb.Append(" <div id='" + this.XPandoID + "'class='switchcontent'> "); sb.Append(" <table width='70%' border='0' cellpadding='0' cellspacing='0' class='menutable_outline'> "); sb.Append(" <tr>"); sb.Append(" <td>adfasdf asdfasdf asdfasd a </td>"); sb.Append(" </tr> "); sb.Append(" </table> "); sb.Append(" </div> "); o.Write(sb.ToString());