private void BindData() { BlogManagementClient.ServiceReference1.Service1Client pr = new BlogManagementClient.ServiceReference1.Service1Client("BasicHttpBinding_IService1"); DataSet ds = pr.GetAllBlog(); GridView1.DataSource = ds; GridView1.DataBind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { BlogManagementClient.ServiceReference1.Service1Client pr = new BlogManagementClient.ServiceReference1.Service1Client("BasicHttpBinding_IService1"); int ID = (int)e.Keys["Id"]; pr.DeleteBlog(ID); BindData(); }
protected void Button1_Click(object sender, EventArgs e) { BlogManagementClient.ServiceReference1.Service1Client pr = new BlogManagementClient.ServiceReference1.Service1Client("BasicHttpBinding_IService1"); Blog b = new Blog(); b.Title = TextBox1.Text; b.Description = TextArea1.Text; b.DateOfUpload = DateTime.Parse(TextBox2.Text); pr.AddBlog(b); Response.Redirect("index.aspx"); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { BlogManagementClient.ServiceReference1.Service1Client pr = new BlogManagementClient.ServiceReference1.Service1Client("BasicHttpBinding_IService1"); int ID = (int)e.Keys["Id"]; Blog b = new Blog(); string title = (string)e.NewValues["title"]; string description = (string)e.NewValues["description"]; DateTime dar = DateTime.Parse((string)e.NewValues["dateofupload"]); b.ID = ID; b.Title = title; b.Description = description; b.DateOfUpload = dar; pr.UpdateBlog(b); GridView1.EditIndex = -1; BindData(); }