DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Mike Guest

    Programmatically accessing table cells

    Is there a way to create a table with rows and cells, and later go back to
    that table and insert or update the data in each cell?

    Thanks

    --




  2. #2
    Constance J. Petersen Guest

    Re: Programmatically accessing table cells

    Hi Mike,

    "Mike" <schome1@yahoo.com> wrote in message news:3ca9b7d7@10.1.10.29...
    > Is there a way to create a table with rows and cells, and later go back to
    > that table and insert or update the data in each cell?


    Sure. Let's say you create them at design time as follows:

    <table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0"
    runat="server">
    <tr>
    <td id="TD1" runat="server">1-1</td>
    <td id="TD2" runat="server">1-2</td>
    <td id="TD3" runat="server">1-3</td>
    </tr>
    </table>

    with a submit button:

    <input id="Submit1" type="submit" value="Submit" name="Submit1" runat="server">

    Then you can insert text at run time as follows:

    Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Submit1.ServerClick
    Table1.Border = (Table1.Border + 1) Mod 7
    TD1.InnerText = "Table border width = " & Table1.Border.ToString
    TD2.InnerHtml = "<b>row 1 cell 2</b>"
    TD3.InnerHtml = "<i>row 1<br>cell 3</i>"
    End Sub

    You can also create tables, table rows, and table cells programmatically. Here's
    a link to some sample code (long url, may break):
    http://samples.gotdotnet.com/quickst...trlref/htmlctr
    l/HtmlTable/doc_table.aspx
    --
    Constance Petersen, DevX newsgroup section leader
    SoftMedia Artisans, Inc.
    http://www.smartisans.com
    For useful, usable software and Web sites
    Featured Web design: http://www.keweenawnow.com/
    --
    Please reply in the newsgroup so everyone can benefit




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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links