SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2007
    Posts
    74
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mapping php program to asp net

    I have a PHP code that out put html code.

    for example :

    <html>
    <body>
    <?php echo "<table>...</table>"; ?>
    </body>
    </html>

    what is proper way to translate above syntax to asp net?

    table does not contains any thing from database. so i am not going to use any data controls

    regards.

  2. #2
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Huh? Literally

    Code:
    <html>
    <body>
        <%= "<table>...</table>" %>
    </body>
    </html>
    You can also use
    Code:
    <% Response.Write("<table>...</table>"); %>
    but I seriously dislike using Response.Write unless absolutely forced to do so because of performance which would be, like, never.

    Why did you use an echo statement in php? Was it to indicate that the table should be dynamically constructed, although not data bound?

    A dynamic table can be constructed like this:

    Code:
    <html>
    <body>
        <asp:Table ID="tbl" runat="server" />
    </body>
    </html>
    
    <script runat="server">
        void Page_Load(object sender, EventArgs e)
        {
            TableRow r = new TableRow();
            r.Cells.Add(new TableCell());
            r.Cells.Add(new TableCell());
            tbl.Rows.Add(r);
        }
    </script>
    This would produce a table with one row and two cells.

  3. #3
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,633
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Honestly, you probably need to databind the table, so you should use a repeater rather than the above.

  4. #4
    SitePoint Wizard
    Join Date
    Feb 2007
    Posts
    1,274
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wwb_99 View Post
    Honestly, you probably need to databind the table, so you should use a repeater rather than the above.
    Agreed; but I assumed that there was some kind of underlying agenda b/c it was a requirement *not* to use data binding.

    Having said that, there is a few use cases for the dynamic table, like illustrating a lottery coupon, cross tabulations etc.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •