codice:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="a.aspx.vb" Inherits="prove_a" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="../js/jquery/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript">
// <!CDATA[
// ]]>
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" />
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</div>
</form>
</body>
</html>
codice:
Option Strict On
Imports l = libreria.ModuloWeb
Partial Class prove_a
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
CreateDynamicTable()
End Sub
Private Sub CreateDynamicTable()
Dim tblRows As Integer = 64
Dim tblCols As Integer = 8
Dim intRQS As Integer = 1
Dim startRow As Integer = ((64 * intRQS) - 64)
Dim tbl As Table = New Table()
tbl.ID = "tblMain"
tbl.Attributes.Add("runat", "server")
PlaceHolder1.Controls.Add(tbl)
For i As Integer = startRow To (startRow + tblRows - 1)
Dim tr As TableRow = New TableRow()
For j As Integer = 0 To tblCols - 1
Dim tc As TableCell = New TableCell()
Dim txtBox As TextBox = New TextBox()
If (j Mod 2) = 0 Then
txtBox.Width = Unit.Pixel(80)
txtBox.Text = "10.14.1." & (i + (64 * (j / 2)))
txtBox.ID = "IP_" & (i + (64 * (j / 2)))
txtBox.BackColor = Drawing.Color.AntiqueWhite
Else
txtBox.Width = Unit.Pixel(150)
txtBox.Text = "Desc. no. " & (i + (64 * (j / 2)))
txtBox.ID = "DS_" & (i + (64 * ((j - 1) / 2)))
txtBox.BackColor = Drawing.Color.Beige
End If
txtBox.Attributes.Add("runat", "server")
txtBox.AutoPostBack = False
txtBox.ReadOnly = True
tc.Controls.Add(txtBox)
tr.Cells.Add(tc)
Next j
tbl.Rows.Add(tr)
Next i
tbl.BorderStyle = BorderStyle.Solid
tbl.BorderColor = Drawing.Color.Black
tbl.BorderWidth = Unit.Pixel(1)
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim j As TextBox = TryCast(Me.PlaceHolder1.FindControl("ip_43"), TextBox)
If j IsNot Nothing Then
PrintLn(j.Text)
End If
End Sub
End Class