/* Metodo para llenar la tabla de unidades */ private void fillUnitGroupTable() { ParameterService parameterService = new ParameterService(); List<UnitView> parameterData = parameterService.getUnits(); GridView2.DataSource = parameterData; GridView2.DataBind(); }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // Label lblParameterId = (e.Row.FindControl("ParameterId") as Label); //Find the DropDownList in the Row DropDownList ddlCountries = (e.Row.FindControl("Unit") as DropDownList); ParameterService parameterService = new ParameterService(); List<UnitView> parameterData = parameterService.getUnits(); ddlCountries.DataSource = parameterData; ddlCountries.DataTextField = "UnitSymbol"; ddlCountries.DataValueField = "UnitId"; ddlCountries.DataBind(); //Add Default Item in the DropDownList // ddlCountries.Items.Insert(0, new ListItem("Please select")); UnitView unit = parameterService.getUnitFromParameter(Int32.Parse(lblParameterId.Text)); ListItem l = new ListItem(unit.UnitSymbol, unit.UnitId + "", true); int indexUnit = ddlCountries.Items.IndexOf(l); ddlCountries.SelectedIndex = indexUnit; } }
/* Metodo que rellena el unit group */ private void fillUnitGroup() { ParameterService parameterService = new ParameterService(); List<UnitView> parameterData = parameterService.getUnits(); UnitText.DataSource = parameterData; UnitText.DataBind(); }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //Find the DropDownList in the Row DropDownList ddlCountries = (e.Row.FindControl("Unit") as DropDownList); ParameterService parameterService = new ParameterService(); List<UnitView> parameterData = parameterService.getUnits(); ddlCountries.DataSource = parameterData; ddlCountries.DataTextField = "UnitName"; ddlCountries.DataValueField = "UnitId"; ddlCountries.DataBind(); //Add Default Item in the DropDownList ddlCountries.Items.Insert(0, new ListItem("Please select")); } }