protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["id"] != null) { FoodTableBind(); Food f = SQLProcedures.GetFoodForID(int.Parse(Request.QueryString["id"])); txtNazivNamirnice.Text = f.Name; foodName = f.Name; rblOdaberiTipNamirnice.SelectedValue = SQLProcedures.GetTypeForFood(int.Parse(Request.QueryString["id"])); unitsWithKcal = SQLProcedures.GetMeasuringUnitsForFoodID(int.Parse(Request.QueryString["id"])); oldUnits = new Dictionary <string, int>(unitsWithKcal); unitsWithKcalList = new List <string>(); foreach (var unit in unitsWithKcal) { unitsWithKcalList.Add($"{unit.Key}({unit.Value})"); ListItem matchedItem = lbDostupneJedinice.Items.FindByText(unit.Key); lbDostupneJedinice.Items.Remove(matchedItem); } lbDodaneJedinice.DataSource = unitsWithKcalList; lbDodaneJedinice.DataBind(); } else { FoodTableBind(); } } }