views:

211

answers:

2

Hey,

This is my aspx code

<body >
    <form id="_form1" runat="server" >        
        <div style=" width:100%; text-align:center;">    
            <div style="width:80%; margin:0 auto;" >
                <asp:ContentPlaceHolder ID="_head"  runat="server"></asp:ContentPlaceHolder>            
            </div>
        </div>    
    </form>
</body>

in my ContentPlaceHolder I have

<div>
This is test...
</div>

When I run this application my html in IE8 renders as

<html>
...

<div>
 <table>
  <tr>
   <td>
    <div> 
      this is test
    <div> 
   </td>
  </tr>
 </table>
<div>

...
</html>

now where is this table coming from and how do i change it ??

Thanks

A: 

What setup are you using? If you are at the beginning of a project and really concerned about the structure of the generated HTML, you may be interested in asp.NET MVC which is more web/html standards oriented.

EDIT - This is the output I get when I do what you say your doing, as far as I can tell from your question.

<body >
    <form name="aspnetForm" method="post" action="WebForm1.aspx" id="aspnetForm">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEwMDUyNjYzMjhkZBdGjIzV2B+QZdda+0wRGTEHyQlg" />
</div>

        <div style=" width:100%; text-align:center;">    
            <div style="width:80%; margin:0 auto;" >

<div>
This is test...
</div>

            </div>
        </div>    
    </form>

</body>

At least four possibilities exist

  1. You're doing it wrong.
  2. I'm doing it wrong but at least getting desired results.
  3. We're both doing it wrong.
  4. We are using different versions of asp.net, setting up our projects differently etc. more details may actually be helpful
Adam Tolley
yeh that does not answer the question. I am wondering why it is doing that . If you just create regular master page and put contentplaceholder for user control and check the html you will see it renders Table.
Ved
Embarrassing but thanks for the comment which forced me to look at the code again and found a mistake on my part...points to you :)
Ved
+1  A: 

Do you have a master page between your MasterPage you defined above and the content that you also defined above. The .NET framework doesn't auto insert tables, the only way that would get inserted in for a ContentPlaceHolder is if one is defined in a master page. Or another process was auto inserting the table structure in.

Also it is not apparent in the UI, but master pages can also have master pages, so make sure you don't have a master page in between that could be adding tables.

Nick Berardi
No I do not have master page under master page but I am using one maing master page. Other than that it is just normal user controls inside div tag.
Ved