예제 #1
0
        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();
        }
예제 #2
0
        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();
        }
예제 #3
0
 private void BindGrid()
 {
     localhost.WebService service = new localhost.WebService();
     GridView1.DataSource = service.GetAllProducts();
     GridView1.DataBind();
 }