Hi,
We can create DataTable dynamically and display the content either in GridView or DataList or in Repeater.
DataTable dataTable = new DataTable();
DataRow dataRow;
dataTable.Columns.Add(new DataColumn("Title", typeof(string)));
dataTable.Columns.Add(new DataColumn("Description", typeof(string)));
dataTable.Columns.Add(new DataColumn("Author", typeof(string)));
if (_post != null)
{
dataRow = dataTable.NewRow();
dataRow[0] = _post.Title;
dataRow[1] = _post.Description;
dataRow[2] = _user.DisplayName;
dataTable.Rows.Add(dataRow);
}
myDataList.DataSource = dataTable;
myDataList.DataBind();
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment