Last post Oct 21, 2009 03:38 AM by ratish_shriyan
Oct 20, 2009 08:10 PM|K_Thibodeaux|LINK
I am very new to ASP.NET and C#, coming from a world of PHP. I have a (hopefully) simple question.
I would like to create a sort of customer tag, for example: I want to be able to define an area, like such:
And be able to put that in an html layout like such:
<asp:whatever>this is a test</asp:whatever> (?)
The ideal result would be:
<table>........<td>this is a test</td>........</table>
There would be no actual C# in the code, just a basic table layout.
Any help would be greatly appreciated =]
Oct 21, 2009 03:38 AM|ratish_shriyan|LINK
You can directly use HTML tags in ASP.NET markup just like you do in a HTML file. So you want to build table you write,
<td> Some Data </td>
However note that if you manipulate this table in the server side you need to add the following attributes,
2. id="myTable" - This isn't mandatory since asp.net will generate an Id by itself, however for refering the control in the server side you need this.
so the above declaration would some thing like this,
<table runat="server" ID="myTable">
Asp.Net also comes with <asp:Table> class which will also render the <table> tags. You can use this as well,
<asp:Table id="myTable" runat="server"> <asp:TableRow> <asp:TableCell> Row 0, Col 0 </asp:TableCell> <asp:TableCell> Row 0, Col 1 </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> Row 1, Col 0 </asp:TableCell> <asp:TableCell> Row 1, Col 1 </asp:TableCell> </asp:TableRow> </asp:Table>Hope this helps!