Hi AnkitPal,
I have created sample code which full-fill your requirement.
HTML
<div>
<fieldset>
<legend>GPNL MIS Details :</legend>
<table id="table01">
<tr>
<th>
S.N.
</th>
<th>
Scheme Name & Code
</th>
<th>
Deposit Amount
</th>
<th>
Monthly Income
</th>
<th>
Maturity Amount
</th>
<th>
Action
</th>
</tr>
<%=getData() %>
</table>
</fieldset>
</div>
C#
protected void Page_Load(object sender, EventArgs e)
{
this.getData();
}
public string getData()
{
string htmlstr = string.Empty;
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[] {
new DataColumn("Id"),
new DataColumn("MIS_Code"),
new DataColumn("DepositAmount"),
new DataColumn("MonthlyIncome"),
new DataColumn("MaturityAmount")
});
dt.Rows.Add("1254d", 5000, 100, 100000);
dt.Rows.Add("1454d", 6000, 120, 150000);
dt.Rows.Add("1454d", 6000, 120, 150000);
dt.Rows.Add("1454d", 6000, 120, 150000);
dt.Rows.Add("1454d", 6000, 120, 150000);
dt.Rows.Add("1454d", 6000, 120, 150000);
dt.Rows.Add("1454d", 6000, 120, 150000);
dt.Rows.Add("1454d", 6000, 120, 150000);
dt.Rows.Add("1454d", 6000, 120, 150000);
dt.Rows.Add("1454d", 6000, 120, 150000);
dt.Rows.Add("1454d", 6000, 120, 150000);
foreach (DataRow rdr in dt.Rows)
{
int sn = rdr.Table.Rows.IndexOf(rdr) + 1;
string code = rdr[1].ToString();
string deposit = rdr[1].ToString();
string income = rdr[2].ToString();
string maturity = rdr[3].ToString();
string action = string.Format("<a href='edit_page.aspx?MIS_Code={0}'><img src='Images/Edit.gif' alt='Edit' /> </a>", code);
htmlstr += "<tr><td>" + sn + "</td><td>" + code + "</td><td>" + deposit + "</td><td>" + income + "</td><td>" + maturity + "</td><td>" + action + "</td></tr>";
}
return htmlstr;
}
Screenshot
S.N. |
Scheme Name & Code |
Deposit Amount |
Monthly Income |
Maturity Amount |
1 |
5000 |
5000 |
100 |
100000 |
2 |
6000 |
6000 |
120 |
150000 |
3 |
6000 |
6000 |
120 |
150000 |
4 |
6000 |
6000 |
120 |
150000 |
5 |
6000 |
6000 |
120 |
150000 |
6 |
6000 |
6000 |
120 |
150000 |
7 |
6000 |
6000 |
120 |
150000 |
8 |
6000 |
6000 |
120 |
150000 |
9 |
6000 |
6000 |
120 |
150000 |
10 |
6000 |
6000 |
120 |
150000 |
11 |
6000 |
6000 |
120 |
15000 |