Asp.Net Table Oluşturma
Default.aspx Sayfası
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Table ID="Table1" runat="server"></asp:Table>
</div>
</form>
</body>
</html>
|
Default.aspx.cs Sayfası
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace AspNet_033_Table
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int sutunSayisi = 3;
int satirSayisi = 5;
for (int i = 0; i < satirSayisi; i++)
{
TableRow satir = new TableRow();
for (int j = 0; j < sutunSayisi; j++)
{
TableCell sutun = new TableCell();
sutun.Text = "Sütun " + i + "-" + j;
sutun.BorderStyle = BorderStyle.Solid;
satir.Cells.Add(sutun);
}
Table1.Rows.Add(satir);
}
}
}
}
|
Leave a reply