Wednesday, March 21, 2012

Panels in tables

Hopefully someone can help me out. I was using panels to add and remove sections of html code that i wanted displayed like below...


<table>
....some html...
<asp:Panel ID="pnl_topic_line" Runat=server>
<TR>
<TD>Topic:</TD>
<TD><asp:TextBox etc... /></TD>
</TR>
</asp:Panel>
...some more html...
</table>

Well, this works great in IE, but in mozilla it does not like <div> tags when they are in the table, but outside the td tags. Anyone know of a better way then panels to add/remove chunks of html code?Don't use the <div> use the <td>
A slight variation on intrader's idea ... use the <tr> (since deleting a single table cell will throw the table's formatting).

So:

<table>
<tr id="FirstRow" runat="server">
<td>first cell</td>
<td>second cell</td>
</tr>
<tr id="SecondRow" runat="server">
<td>third cell</td>
<td>fourth cell</td>
</tr>
</table>

Then, in your code, you can simply "delete" one of those rows:

if (sometest) {
FirstRow.Visible = false;
} else {
SecondRow.Visible = false;
}

Correct, I was not thinking of deletes or inserts of cells.

Inserting and delete cells has its own DOM syntax from normal DOM stiching.

0 comments:

Post a Comment