protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (!IsPostBack) if (e.CommandName == "ADD") { Button Button1 = (Button)GridView1.FooterRow.FindControl("Button1"); TextBox txtfooterid = (TextBox)GridView1.FooterRow.FindControl("txtfooterid"); TextBox txtfootername = (TextBox)GridView1.FooterRow.FindControl("txtfootername"); SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=master;Integrated Security=True"); SqlCommand cmd = new SqlCommand("insert into tab1(id,name) values('"+txtfooterid.Text+"','"+txtfootername.Text+"')", con); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; DataTable dt = new DataTable(); da.Fill(dt); GridView1.DataSource = dt; GridView1.DataBind(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)