private void AddRarities(DropDownList list) { DataSet ds = cardsService.GetAllRarities(); foreach (DataRow row in ds.Tables["Rarities"].Rows) { list.Items.Add(new ListItem(row["rarityName"].ToString(), row["rarityId"].ToString())); } }
public static void AddRarities(DropDownList raritiesDropDownList) { try { CardsService cardsServices = new CardsService(); DataSet cardsDataSet = cardsServices.GetAllRarities(); Utilities.AddToDropDownList(cardsDataSet, raritiesDropDownList, "Rarities", "rarityName", "rarityId"); } catch (Exception ex) { Debug.WriteLine(ex.StackTrace); } }