hai
The Code is used for creating Dynamic table using the Classes like DataTable,DataRow and the table is added to the Gridview Control Code given Below using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class DynamicDataTable : System.Web.UI.Page
{
DataTable objTable = new DataTable("dtTable");
DataRow drRow;
protected void Page_Load(object sender, EventArgs e)
{
objTable.Columns.Add(new DataColumn("ID", typeof(int)));
objTable.Columns.Add(new DataColumn("Name", typeof(string)));
for (int count = 1; count <= 5; ++count)
{
drRow = objTable.NewRow();
drRow[0] = count;
drRow[1] = "Pramod:" + count.ToString();
objTable.Rows.Add(drRow);
}
GridView1.DataSource = objTable;
GridView1.DataBind();
}
}
pramod.v.g