How to Add Textfield column into Gridview in asp.net C# ?
I need to add a Text field Column at last of the Gridview, I create Data Table dynamically like this. I need to add text fields for comisson column
DataTable dt = new DataTable(); // create data table
dt.Columns.Add("TransDate"); // create column 1
dt.Columns.Add("ExHouse");// create column 2
dt.Columns.Add("RemName");
dt.Columns.Add("Currency");
dt.Columns.Add("Amount");
dt.Columns.Add("LKRAmount");
//dt.Columns.Add(new DataColumn("Comission", typeof(string)));
dt.Columns.Add("Comission");
dt.Columns.Add("ValueDate");
DataRow dr = dt.NewRow(); // Create new Row
TextBox comi=new TextBox();
dr["TransDate"] = RemittanceToSelectedTable.TransDate;
dr["ExHouse"] = RemittanceToSelectedTable.ExHouse; //add data to coolumn no2
dr["RemName"] = RemittanceToSelectedTable.RemName;
dr["Currency"] = RemittanceToSelectedTable.Currency;
dr["Amount"] = RemittanceToSelectedTable.Amount;
dr["LKRAmount"] = RemittanceToSelectedTable.LKRAmount;
dr["ValueDate"] = RemittanceToSelectedTable.ValueDate;
dr["Comission"] = comi;
aa.Add((string)dr["TransDate"]);
ab.Add((string)dr["ExHouse"]);
ac.Add((string)dr["RemName"]);
ad.Add((string)dr["Currency"]);
ae.Add((string)dr["Amount"]);
af.Add((string)dr["LKRAmount"]);
// ah.Add((string)dr["Comission"]);
ag.Add((string)dr["ValueDate"]);
for (i = 0; i < ag.Count; i++)
{
dt.Rows.Add(aa[i], ab[i], ac[i], ad[i], ae[i], af[i], ag[i]); // add rows to data table
}
return dt;
Thanks !