protected void btnupload_Click(object sender, EventArgs e) { try { ClientsTableAdapter clients_insert = new ClientsTableAdapter(); if (hdnId.Value.Length > 0) { int? id = Int32.Parse(hdnId.Value); clients_insert.UpdateClientById(txtcmpname.Text, taNews.Value,id); // successlbl.Text = "Clients Updated Successfully"; Response.Write("<script>alert('Clients Updated Successfully') ; location.href='EditClients.aspx'</script>"); //Response.Write("<script>alert('Clients Updated Successfully');</script>"); // Response.Redirect("EditClients.aspx"); } else { clients_insert.Insert(txtcmpname.Text, taNews.Value); // Response.Write("<script>alert('News Uploaded Successfully');</script>"); successlbl.Text = "Clients Uploaded Successfully"; txtcmpname.Text = string.Empty; taNews.Value = string.Empty; //Server.Transfer("AddClients.aspx"); } } catch (Exception ex) { } }
protected void clientsGrid_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridView gv = sender as GridView; GridViewRow row = gv.Rows[e.RowIndex]; int? id = Int32.Parse(row.Cells[1].Text); ClientsTableAdapter adptr = new ClientsTableAdapter(); adptr.DeleteClientsById(id); Server.Transfer("EditClients.aspx"); }
protected void Page_Load(object sender, EventArgs e) { ClientsTableAdapter adptr = new ClientsTableAdapter(); clientsGrid.DataSource = adptr.GetClientsData(); clientsGrid.DataBind(); clientsGrid.HeaderRow.Cells[1].Visible = false; foreach (GridViewRow gvr in clientsGrid.Rows) { gvr.Cells[1].Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { EditClients epage = Context.Handler as EditClients; if (epage != null) { hdnId.Value = epage.Id; } if (hdnId.Value.Length > 0) { int? id = Int32.Parse(hdnId.Value); if (btnupload.Text != "Update") { ClientsTableAdapter adptr = new ClientsTableAdapter(); TaxGenie_DAL.Clients.ClientsDataTable dt = adptr.SelectClientById(id); TaxGenie_DAL.Clients.ClientsRow row = dt.Rows[0] as TaxGenie_DAL.Clients.ClientsRow; txtcmpname.Text = row.Client_Name; taNews.Value = row.Address; btnupload.Text = "Update"; } } }
protected void Page_Load(object sender, EventArgs e) { ClientsTableAdapter clients = new ClientsTableAdapter(); dlClients.DataSource = clients.GetClientsData(); dlClients.DataBind(); }