开发者

Issue with RenderOuterTable property for .NET 4.0 controls

According to the new 4.0 framework overview, one should be able to add the attribute RenderOuterTable="false" to a control that supports the attribute and see CSS friendly code be spit out - in other words no HTML tables.

To test this, I threw a login control into a basic fresh webpage with the following code:

<asp:Login ID="Login1" runat="server" RenderOuterTable="false"></asp:Login>

The result? Crappy HTML table output, which supposedly doesn't happen with this attribute set to false. Here is the output:

<table cellpadding="0"> 
<tr> 
    <td align="center" colspan="2">Log In</td>    
</tr>
<tr> 
    <td align="right"><label for="MainContent_Login1_UserName">User Name:</label></td>
    <td>
       <input name="ctl00$MainContent$Login1$UserName" type开发者_运维技巧="text" id="MainContent_Login1_UserName" /> 
       <span id="MainContent_Login1_UserNameRequired" title="User Name is required." style="visibility:hidden;">*</span>
    </td>...

Hopefully you get the point. How can these controls be stopped from outputting tables? This is super annoying.


Convert the Login control to a template. It will give you full control of the layout without a table in sight (including the outer table which previously got generated even if you used the template option).


It doesn't say that it will get rid of all tables, just that it will get rid of the extra outer table that was used to apply styles. Try getting rid of the property and note the extra table that wraps the one you quoted above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜