I can't claim it to be the best optimized code or way but it can resolve your problem for sure. I have tried and it's working fine at my end.
DataTable dt = new DataTable();
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Department", typeof(string));
dt.Columns.Add("Age", typeof(string));
dt.Columns.Add("Salary", typeof(string));
dt.AcceptChanges();
string[] arrs=txtDemo.Text.Split(new string[]{"\n","\r"},StringSplitOptions.RemoveEmptyEntries);
foreach (string arr in arrs)
{
string[] arrCol = arr.Split(' ');
DataRow dr = dt.NewRow();
dr["Name"] = arrCol[0];
dr["Department"] = arrCol[1];
dr["Age"] = arrCol[2];
dr["Salary"] = arrCol[3];
dt.Rows.Add(dr);
}
dt.AcceptChanges();
gv.DataSource = dt;
gv.DataBind();
Note: you need to add code for validating input and input format.
Hopefully, it helps :)