protected void LinkButton_Click(object sender, EventArgs e) { string Phone = SqlDataSource1.InsertParameters["Phone"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("TextBoxPhone")).Text; string Names = SqlDataSource1.InsertParameters["Name"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("TextBoxName")).Text; GridEntities gridEntities = new GridEntities(); customer customer = new customer() { Name = Names, Phone = Phone }; gridEntities.customers.Add(customer); gridEntities.SaveChanges(); Response.Redirect("WebForm1.aspx"); }
protected void Page_Load(object sender, EventArgs e) { GridEntities grid = new GridEntities(); }