• The eternal confessions of a beautiful mind...
  • DamianM.Co.UK
  • Home
  • About
  • Archives
  • Contact
  • Sitemap
  • My Flickr

    IMG_9585IMG_9115IMG_9113IMG_9111IMG_9078IMG_9075IMG_9069IMG_9065IMG_9041IMG_9032IMG_8963IMG_8928IMG_8916IMG_8915IMG_8904IMG_8876IMG_8858IMG_8830IMG_8828IMG_8826

  • Recent Posts

    • New Ohio Roller Coaster - INSANE!!!
    • Speeding
    • Captions not required
    • Unfortunate Backgrounds
    • Unfortunate Signs
    • OMG!!
    • Women as explained by engineer
    • The Monty Hall Problem
    • ahhh still love them - Motivational Posters
    • What does Mona Lisa do when the Museum is closed………
    • 21st Century kids books
    • Cool Origami
    • AWESOME Pictures!
    • Things you shouldn’t find in your vegetable patch!
    • World’s Best Graffiti…?
  • My Tools

    • Blog_LinkIt
    • DCoda Theme
    • DCoda Widgets
    • RSS_Sticky
    • WordPress.org
    • WP_BlogNetworking
    • WP_BlogRollSync
    • WP_BoilerPlate
    • WP_Censor
    • WP_ContactMe
    • WP_DeliciousPost
    • WP_EasyReply
    • WP_HeadNFoot
    • WP_LinkIt
    • WP_OneInstall
    • WP_PostDate
    • WP_PostNotes
    • WP_RssSticky
    • WP_Spoiler
    • WP_Submission
  • My Web

    • ASPAlliance
    • ClaimID
    • del.ico.us
    • Digg
    • DSLRBlog
    • DVDProfiler
    • Flickr
    • Honeyed SPAM
    • My Blog
    • My company
    • MYSpace
    • WordPress.org
    • YouTube

    NewTable Code

    NewTable.aspx

    1
    2
    3
    4
    5
    
    <%@ Control Language="vb" AutoEventWireup="false" Codebehind="newtable.ascx.vb" Inherits="DamianM.newtable" %>
    <%@ Register TagPrefix="cc1" Namespace="DamianM" Assembly="DamianM" %>
    <center>
    	<asp:Table id="Table1" runat="server"></asp:Table>
    </center>

    NewTable.aspx.vb

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    
    Imports System
    Imports System.Web.UI.WebControls
    Public Class newtable
        Inherits System.Web.UI.UserControl
        Protected WithEvents Table1 As System.Web.UI.WebControls.Table
     
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'declare holders for the rows and cells you are going to create
            Dim r As System.Web.UI.WebControls.TableRow
            Dim c As System.Web.UI.WebControls.TableCell
     
            'all the tables attribute are available to be set
            'although through different names
            Table1.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1)
            Table1.Width = System.Web.UI.WebControls.Unit.Percentage(50)
     
            'creare a new row
            r = New System.Web.UI.WebControls.TableRow()
            'create a new cell
            c = New System.Web.UI.WebControls.TableCell()
     
            'all the cells attribute are available to be set
            'although through different names
            c.ColumnSpan = 2
            'notice that now you are quite rightly restricted
            'an enumeration of values
            c.HorizontalAlign = HorizontalAlign.Center
            'and here you choose you color from an enumeration
            c.BackColor = System.Drawing.Color.Silver
            c.Text = "Server Created Table"
     
            'add the new cell to the row
            r.Cells.Add(c)
     
            'add the new row to the table
            Table1.Rows.Add(r)
     
            'a loop to create a sample table
            Dim i As Integer
            For i = 0 To 10
                r = New System.Web.UI.WebControls.TableRow()
     
                'all the rows attribute are available to be set
                'although through different names
                r.BackColor = System.Drawing.Color.FromArgb(&H999999 + (i * 1024)) ' set the color to something
     
                c = New System.Web.UI.WebControls.TableCell()
                c.Text = i.ToString
                r.Cells.Add(c)
                c = New System.Web.UI.WebControls.TableCell()
                c.Text = "this is row " + i.ToString
                r.Cells.Add(c)
                Table1.Rows.Add(r)
            Next
     
        End Sub
     
        Private Sub InitializeComponent()
     
        End Sub
    End Class

    Leave a Reply

    Related Posts from the Past:

    • Scraping in one line using temporary objects code
    • Me Code Monkey
    • CSS: Standards
    • Email
    • .NET Screen Scraping in depth