Table tbldynamic = new Table();
for (int i = 0; i < 5; i++)
{
TableCell tc = new TableCell();
TableRow tr = new TableRow();
Image _checkbox = new Image();
_checkbox.ID = "chkDynamicCheckBox" + i;
_checkbox.ImageUrl = "k4.jpeg";
tc.Controls.Add(_checkbox);
tr.Cells.Add(tc);
tbldynamic.Rows.Add(tr);
}
Panel1.Controls.Add(tbldynamic);
Panel1.Visible = true;
------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<!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 id="Head1" runat="server">
<title></title>
<style type="text/css">
.style1 {
width: 30%;
border-color: #FFCCFF;
background-color: #FFCCCC;
}
.style2
{
width: 87px;
}
</style>
</head>
<body>
<form id="form2" runat="server">
<div>
<asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" />
<asp:Panel ID="Panel1" runat="server">
<table align="center" class="style1">
<tr>
<td class="style2">
Name</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2">
City</td>
<td>
<asp:TextBox ID="TextBox2" runat="server" ></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2">
</td>
<td>
<asp:Button ID="Button1" runat="server" Text="Button" />
</td>
</tr>
</table>
</asp:Panel>
</div>
</form>
</body>
</html>
for (int i = 0; i < 5; i++)
{
TableCell tc = new TableCell();
TableRow tr = new TableRow();
Image _checkbox = new Image();
_checkbox.ID = "chkDynamicCheckBox" + i;
_checkbox.ImageUrl = "k4.jpeg";
tc.Controls.Add(_checkbox);
tr.Cells.Add(tc);
tbldynamic.Rows.Add(tr);
}
Panel1.Controls.Add(tbldynamic);
Panel1.Visible = true;
------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<!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 id="Head1" runat="server">
<title></title>
<style type="text/css">
.style1 {
width: 30%;
border-color: #FFCCFF;
background-color: #FFCCCC;
}
.style2
{
width: 87px;
}
</style>
</head>
<body>
<form id="form2" runat="server">
<div>
<asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" />
<asp:Panel ID="Panel1" runat="server">
<table align="center" class="style1">
<tr>
<td class="style2">
Name</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2">
City</td>
<td>
<asp:TextBox ID="TextBox2" runat="server" ></asp:TextBox>
</td>
</tr>
<tr>
<td class="style2">
</td>
<td>
<asp:Button ID="Button1" runat="server" Text="Button" />
</td>
</tr>
</table>
</asp:Panel>
</div>
</form>
</body>
</html>
No comments:
Post a Comment