Dear friends I have a issue in my codes. I am doing gridview insert ,update,delete events program.
I took one footer and displayed two textboxs and one Add button in the <EditItemTemplate>.
I have bound gridview.and displayed on the webform1.aspx properly.and on the RowCommand Event.
When I click on the add button for insert the values into my table from the Gridview’s rows. So my current page becomes blank. And everything becomes hide from the current page . why ???
My code are
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();
}