protected void btnEdit_Command(object sender, CommandEventArgs e) { editid.Value = e.CommandArgument.ToString(); DataTable dt = objBrand.GetBrandMasterById(Session["CompId"].ToString(), editid.Value); if (dt.Rows.Count > 0) { txtBrandCode.Text = dt.Rows[0]["Brand_Code"].ToString(); txtBrandName.Text = dt.Rows[0]["Brand_Name"].ToString(); txtBrandNameL.Text = dt.Rows[0]["Brand_Name_L"].ToString(); if (dt.Rows[0]["Emp_Id"].ToString().Trim() != "0" || dt.Rows[0]["Emp_Id"].ToString().Trim() != "") { txtManagerName.Text = cmn.GetEmpName(dt.Rows[0]["Emp_Id"].ToString()); } else { txtManagerName.Text = ""; } imgLogo.ImageUrl = "~/CompanyResource/" + "/" + Session["CompId"].ToString() + "/" + dt.Rows[0]["Logo_Path"].ToString(); Session["empimgpath"] = dt.Rows[0]["Logo_Path"].ToString(); DataTable dtChild = objAddChild.GetAddressChildDataByAddTypeAndAddRefId("Brand", editid.Value); if (dtChild.Rows.Count > 0) { GvAddressName.DataSource = dtChild; GvAddressName.DataBind(); } btnNew_Click(null, null); btnNew.Text = Resources.Attendance.Edit; } }
public void FillAddressChidGird(string CommandName) { DataTable dt = new DataTable(); if (CommandName.ToString() == "Del") { dt = FillAddressDataTabelDelete(); } else if (CommandName.ToString() == "Edit") { dt = FillAddressDataTableUpdate(); } else { dt = FillAddressDataTabel(); } GvAddressName.DataSource = dt; GvAddressName.DataBind(); ResetAddressName(); }
public DataTable FillAddressDataTabel() { string strNewSNo = string.Empty; DataTable dt = CreateAddressDataTable(); if (GvAddressName.Rows.Count > 0) { for (int i = 0; i < GvAddressName.Rows.Count + 1; i++) { if (dt.Rows.Count != GvAddressName.Rows.Count) { dt.Rows.Add(i); Label lblSNo = (Label)GvAddressName.Rows[i].FindControl("lblSNo"); Label lblAddressName = (Label)GvAddressName.Rows[i].FindControl("lblgvAddressName"); dt.Rows[i]["Trans_Id"] = lblSNo.Text; strNewSNo = lblSNo.Text; dt.Rows[i]["Address_Name"] = lblAddressName.Text; } else { dt.Rows.Add(i); dt.Rows[i]["Trans_Id"] = (float.Parse(strNewSNo) + 1).ToString(); dt.Rows[i]["Address_Name"] = txtAddressName.Text; } } } else { dt.Rows.Add(0); dt.Rows[0]["Trans_Id"] = "1"; dt.Rows[0]["Address_Name"] = txtAddressName.Text; } if (dt.Rows.Count > 0) { GvAddressName.DataSource = dt; GvAddressName.DataBind(); } return(dt); }
public void Reset() { txtBrandCode.Text = ""; txtBrandName.Text = ""; txtBrandNameL.Text = ""; txtManagerName.Text = ""; imgLogo.ImageUrl = ""; txtAddressName.Text = ""; btnNew.Text = Resources.Attendance.New; lblSelectedRecord.Text = ""; ViewState["Select"] = null; editid.Value = ""; txtValue.Text = ""; ddlOption.SelectedIndex = 2; ddlFieldName.SelectedIndex = 0; GvAddressName.DataSource = null; GvAddressName.DataBind(); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtValue); }