public void newrow()
{
DataTable dt = new DataTable();
DataRow dr = null;
dt.Columns.Add(new DataColumn("Select", typeof(string)));
dt.Columns.Add(new DataColumn("sr_no", typeof(string)));
dt.Columns.Add(new DataColumn("Source", typeof(string)));
dt.Columns.Add(new DataColumn("Destination", typeof(string)));
dt.Columns.Add(new DataColumn("Rate", typeof(string)));
dr = dt.NewRow();
dr["Select"] = string.Empty;
dr["sr_no"] = string.Empty;
dr["Source"] = string.Empty;
dr["Destination"] = string.Empty;
dr["Rate"] = string.Empty;
dt.Rows.Add(dr);
gridNEW_REC.DataSource = dt;
gridNEW_REC.DataBind();
}
public void addnewrow()
{
conn.cn.Open();
DataTable dt = new DataTable();
DataRow dr;
dt.Columns.Add(new DataColumn("Select", typeof(string)));
dt.Columns.Add(new DataColumn("sr_no", typeof(string)));
dt.Columns.Add(new DataColumn("Source", typeof(string)));
dt.Columns.Add(new DataColumn("Destination", typeof(string)));
dt.Columns.Add(new DataColumn("Rate", typeof(string)));
if (gridNEW_REC.Rows.Count > 0)
{
for (int i = 0; i < gridNEW_REC.Rows.Count; i++)
{
dr = dt.NewRow();
TextBox t1 = (TextBox)gridNEW_REC.Rows[i].Cells[1].FindControl("txtno");
dr[1] = Convert.ToString(t1.Text);
TextBox t2 = (TextBox)gridNEW_REC.Rows[i].Cells[2].FindControl("txtSOURCE_STATION");
dr[2] = Convert.ToString(t2.Text);
TextBox t3 = (TextBox)gridNEW_REC.Rows[i].Cells[4].FindControl("txtDEST_STATION");
dr[3] = Convert.ToString(t3.Text);
TextBox t4 = (TextBox)gridNEW_REC.Rows[i].Cells[6].FindControl("txtRATE");
dr[4] = Convert.ToString(t4.Text);
dt.Rows.Add(dr);
}
dr = dt.NewRow();
dt.Rows.Add(dr);
gridNEW_REC.DataSource = dt;
gridNEW_REC.DataBind();
auto_gen_grid_no();
}
}
{
DataTable dt = new DataTable();
DataRow dr = null;
dt.Columns.Add(new DataColumn("Select", typeof(string)));
dt.Columns.Add(new DataColumn("sr_no", typeof(string)));
dt.Columns.Add(new DataColumn("Source", typeof(string)));
dt.Columns.Add(new DataColumn("Destination", typeof(string)));
dt.Columns.Add(new DataColumn("Rate", typeof(string)));
dr = dt.NewRow();
dr["Select"] = string.Empty;
dr["sr_no"] = string.Empty;
dr["Source"] = string.Empty;
dr["Destination"] = string.Empty;
dr["Rate"] = string.Empty;
dt.Rows.Add(dr);
gridNEW_REC.DataSource = dt;
gridNEW_REC.DataBind();
}
public void addnewrow()
{
conn.cn.Open();
DataTable dt = new DataTable();
DataRow dr;
dt.Columns.Add(new DataColumn("Select", typeof(string)));
dt.Columns.Add(new DataColumn("sr_no", typeof(string)));
dt.Columns.Add(new DataColumn("Source", typeof(string)));
dt.Columns.Add(new DataColumn("Destination", typeof(string)));
dt.Columns.Add(new DataColumn("Rate", typeof(string)));
if (gridNEW_REC.Rows.Count > 0)
{
for (int i = 0; i < gridNEW_REC.Rows.Count; i++)
{
dr = dt.NewRow();
TextBox t1 = (TextBox)gridNEW_REC.Rows[i].Cells[1].FindControl("txtno");
dr[1] = Convert.ToString(t1.Text);
TextBox t2 = (TextBox)gridNEW_REC.Rows[i].Cells[2].FindControl("txtSOURCE_STATION");
dr[2] = Convert.ToString(t2.Text);
TextBox t3 = (TextBox)gridNEW_REC.Rows[i].Cells[4].FindControl("txtDEST_STATION");
dr[3] = Convert.ToString(t3.Text);
TextBox t4 = (TextBox)gridNEW_REC.Rows[i].Cells[6].FindControl("txtRATE");
dr[4] = Convert.ToString(t4.Text);
dt.Rows.Add(dr);
}
dr = dt.NewRow();
dt.Rows.Add(dr);
gridNEW_REC.DataSource = dt;
gridNEW_REC.DataBind();
auto_gen_grid_no();
}
}
No comments:
Post a Comment