protected void TxtProductName_TextChanged(object sender, EventArgs e) { try { DataTable DtProduct = new DataTable(); string Comp_Code = Session["COMP_CODE"].ToString(); DtProduct = STOCK_MASLogicLayer.GetAllSTOCK_MASDetialsWIiseCompanyFor_DDL(Comp_Code); if (TxtProductName.Text != string.Empty) { DataView Dv = new DataView(DtProduct); Dv.RowFilter = "SNAME='" + TxtProductName.Text.Trim() + "'"; DataTable DtView = Dv.ToTable(); if (DtView.Rows.Count > 0) { HfDetailSCode.Value = DtView.Rows[0]["SCODE"].ToString(); TxtProductCode.Text = DtView.Rows[0]["PROD_CODE"].ToString(); } } } catch (Exception) { throw; } }
public void FillTxtProductNameOnUpdate(string Id) { try { string Comp_Code = Session["COMP_CODE"].ToString(); DataTable Dt = new DataTable(); Dt = STOCK_MASLogicLayer.GetAllSTOCK_MASDetialsWIiseCompanyFor_DDL(Comp_Code); if (HfDetailSCode.Value.ToString() != "0") { DataView Dv = new DataView(Dt); Dv.RowFilter = "SCODE=" + Id; DataTable DtView = Dv.ToTable(); TxtProductName.Text = DtView.Rows[0]["SNAME"].ToString(); HfDetailSCode.Value = DtView.Rows[0]["SCODE"].ToString(); TxtProductCode.Text = DtView.Rows[0]["PROD_CODE"].ToString(); } } catch (Exception) { throw; } }
protected void GvBranchReceivedDetails_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { TextBox TxtProductName = (e.Row.FindControl("TxtProductName") as TextBox); TextBox TxtProductCode = (e.Row.FindControl("TxtProductCode") as TextBox); TextBox TxtQty = (e.Row.FindControl("TxtQty") as TextBox); HiddenField HfDetailSCode = (e.Row.FindControl("HfDetailSCode") as HiddenField); DataTable DtProduct = new DataTable(); string Comp_Code = Session["COMP_CODE"].ToString(); DtProduct = STOCK_MASLogicLayer.GetAllSTOCK_MASDetialsWIiseCompanyFor_DDL(Comp_Code); if (HfDetailSCode.Value != "0" && HfDetailSCode.Value != string.Empty) { DataView Dv = new DataView(DtProduct); Dv.RowFilter = "SCODE=" + HfDetailSCode.Value; DataTable DtView = Dv.ToTable(); if (DtView.Rows.Count > 0) { TxtProductName.Text = DtView.Rows[0]["SNAME"].ToString(); TxtProductCode.Text = DtView.Rows[0]["PROD_CODE"].ToString(); } else { TxtProductName.Text = string.Empty; TxtProductCode.Text = string.Empty; } } } } catch (Exception) { throw; } }