protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e) { long PID = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0]); localhost.WebService service = new localhost.WebService(); service.Delete(PID); this.BindGrid(); }
protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = GridView1.Rows[e.RowIndex]; long PID = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0]); string PName = (row.FindControl("txtPName") as TextBox).Text; string PPrice = (row.FindControl("txtPPrice") as TextBox).Text; string PDescription = (row.FindControl("txtPDescription") as TextBox).Text; localhost.WebService service = new localhost.WebService(); service.Update(PID, PName, PPrice, PDescription); GridView1.EditIndex = -1; this.BindGrid(); }
private void BindGrid() { localhost.WebService service = new localhost.WebService(); GridView1.DataSource = service.GetAllProducts(); GridView1.DataBind(); }