protected void gvOptionCategory_DataBound(object sender, EventArgs e) { foreach (GridViewRow GvOptrow in gvOptionCategory.Rows) { try { string ProductId = ViewState["ProductId"].ToString(); RadioButtonList RdoList = (RadioButtonList)GvOptrow.FindControl("rdoOption"); Label lblOpCatiD = (Label)GvOptrow.FindControl("lblOptionCategoryId"); DataTable dtOption = new DataView(ObjInvBOM.BOM_ByProductId(StrCompId.ToString(), ProductId.ToString()), "OptionCategoryId='" + lblOpCatiD.Text.Trim() + "'", "", DataViewRowState.CurrentRows).ToTable(); foreach (DataRow row in dtOption.Rows) { var txt = string.Empty; string ProductName = string.Empty; if (row["SubProductId"].ToString() == "0") { txt = row["OptionId"].ToString() + " ( " + row["ShortDescription"].ToString() + " )"; } else { ProductName = new DataView(ObjInvProductMaster.GetProductMasterTrueAll(StrCompId.ToString()), "ProductId = '" + row["SubProductId"].ToString().Trim() + "'", "", DataViewRowState.CurrentRows).ToTable().Rows[0]["EProductName"].ToString(); txt = row["OptionId"].ToString() + " ( " + ProductName.ToString() + " ," + row["ShortDescription"].ToString() + " )"; } var val = row["TransID"].ToString(); var item = new ListItem(txt, val); RdoList.Items.Add(item); } } catch { } } }
public void fillGrid() { string ProductId = new DataView(ObjInvProductMaster.GetProductMasterTrueAll(StrCompId.ToString()), "EProductName like '" + txtProductId.Text.Trim() + "%'", "", DataViewRowState.CurrentRows).ToTable().Rows[0]["ProductId"].ToString(); DataTable dt = ObjInvBOM.BOM_ByProductId(StrCompId.ToString(), ProductId.ToString()); gvProductSpecsChild.DataSource = dt; gvProductSpecsChild.DataBind(); AllPageCode(); }