Here I will show you to
create user defined table having rows and columns of your choice by selecting
dropdownlist control and here we can able to know their respective cell
positions.
Program
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub h1(ByVal s
As Object,
ByVal e As
EventArgs)
Dim x, y, p, q As Integer
x = select1.value
y = select2.value
For
p = 0 To x - 1
Dim r1 As New htmltablerow
For q = 0 To y -
1
Dim c1 As New htmltablecell
c1.innerhtml = "cell " & p &
"," & q
r1.cells.add(c1)
Next
table1.rows.add(r1)
Next
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled
Page</title>
<style type="text/css">
#Button1
{
width: 174px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<select id="Select2" name="Select2" runat="server">
<option value="1"
selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>
<div>SEELCT
NO OF COLS</div>
<select id="Select1" name="Select1" runat="server">
<option value="1"
selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select><input id="Button1"
type="button" value="Select 2
dropdownlist click"
name="Button1" runat="server" onserverclick="h1"/>
<div>SELECT
NO OF ROWS</div>
<table id="table1" width="300" border="10" runat="server" bordercolor ="#cc9933">
</table>
</form>
</body>
</html>
Output
