public void loadAsset(int id) { adminTableAdapters.BranchTableAdapter branch = new adminTableAdapters.BranchTableAdapter(); admin.BranchDataTable tblBranch = branch.GetBranchDetails(id); if (tblBranch.Rows.Count > 0) { try { this.editskip.Value = "2"; txtBranch.Value = tblBranch[0].datDescription.ToString(); txtaddress.Value = tblBranch[0].datAddress.ToString(); ddlArea.SelectedIndex = ddlArea.Items.IndexOf(ddlArea.Items.FindByValue(tblBranch[0].datLocation.ToString())); txtTelephone.Value = tblBranch[0].datTelephone.ToString(); } catch (Exception ex) { } } }
public void loadAsset(int id) { adminTableAdapters.BranchTableAdapter branch = new adminTableAdapters.BranchTableAdapter(); admin.BranchDataTable tblBranch = branch.GetBranchDetails(id); if(tblBranch.Rows.Count>0) { try { this.editskip.Value = "2"; txtBranch.Value = tblBranch[0].datDescription.ToString(); txtaddress.Value = tblBranch[0].datAddress.ToString(); ddlArea.SelectedIndex = ddlArea.Items.IndexOf(ddlArea.Items.FindByValue(tblBranch[0].datLocation.ToString())); txtTelephone.Value = tblBranch[0].datTelephone.ToString(); } catch (Exception ex) { } } }
protected void btnSave_Click(object sender, EventArgs e) { adminTableAdapters.BranchTableAdapter Branch = new adminTableAdapters.BranchTableAdapter(); if (!(type == "update")) { Branch.InsertBranch(txtBranch.Value.Trim(), Convert.ToInt32(ddlArea.Text), txtaddress.Value, txtTelephone.Value); } else if (type == "update") { Branch.UpdateBranch(txtBranch.Value.Trim(), Convert.ToInt32(ddlArea.Text), txtaddress.Value, txtTelephone.Value, id); } Page.Response.Redirect(util.RemoveQueryStringByKey(HttpContext.Current.Request.Url.AbsoluteUri, "bredit")); }