Nagendra Panyam

Nagendra Panyam

  • NA
  • 190
  • 17.4k

i had to generate loop for inserting rows and columns

Jan 29 2019 9:16 PM
 i had tried fallowing
DataTable _datatable=new DataTable("Empinfo");
public DataTable DataTable
{
get { return _datatable; }
set { _datatable = value; }
}
public void CreateNewRow()
{
this._datatable = new DataTable("Table");
this._datatable.Columns.Add("Name");
this._datatable.Columns.Add("Id");
this._datatable.Columns.Add("Age");
this._datatable.Columns.Add("Title");
this._datatable.Rows.Add(txtName.Text, txtId.Text, txtAge.Text, txtTitle.Text);
this.gridtest.DataContext = this;
}
private void Submitbtn_Click(object sender, RoutedEventArgs e)
{
CreateNewRow();

Answers (11)