hi all, i need some help, i need to dinamicly add rows to a table, and i dunno how to do this, i have an error in my code but i cant correct it , can anyone help ?
public partial class multiple_columns : System.Web.UI.Page
{
private void SetInitialRow()
{
DataTable dt = new DataTable();
DataRow dr = null;
dt.Columns.Add(new DataColumn("Tipo", typeof(string)));
dt.Columns.Add(new DataColumn("URL", typeof(string)));
dt.Columns.Add(new DataColumn("IMG", typeof(string)));
dt.Columns.Add(new DataColumn("Texto", typeof(string)));
dr = dt.NewRow();
dr["Tipo"] = 1;
dr["URL"] = string.Empty;
dr["Texto"] = string.Empty;
dt.Rows.Add(dr);
//Store the DataTable in ViewState
ViewState["CurrentTable"] = dt;
Dados.DataSource = dt;
...
Go to the complete details ...