protected void Page_Load(object sender, EventArgs e) { MessageLabel.Text = ""; if (!Page.IsPostBack) { List <MoviesStarsDropDown> DataCollectionStars = new List <MoviesStarsDropDown>(); //MovieStarsDropDown is the name of the class (List of type that class name) //DataCollectionStars is the name of our new created List DataCollectionStars.Add(new MoviesStarsDropDown(1, "1 Star")); // new MovieStarsDropDown (name of the class that we created) --> ist ein Object createn DataCollectionStars.Add(new MoviesStarsDropDown(3, "2 Stars")); DataCollectionStars.Add(new MoviesStarsDropDown(4, "3 Stars")); DataCollectionStars.Add(new MoviesStarsDropDown(2, "4 Stars")); DataCollectionStars.Add(new MoviesStarsDropDown(5, "5 Stars")); //Namen werden in der Liste gesorted DataCollectionStars.Sort((x, y) => x.displayField.CompareTo(y.displayField)); StarList.DataSource = DataCollectionStars; //StarList is the ID (name) of the DropDownList in the webpage where we created the form that the user can see //DataCollectionStars is the name of our created list in which the entries are listed and we sorted //The DropDown (StarList) is getting the data from our list (DataCollectionStars) //The DropDown (StarList); we make sure which of the two fields (displayField, valueField) we wanna have displayed in the dropdown StarList.DataTextField = nameof(MoviesStarsDropDown.displayField); //We bind the data to the DropDown StarList.DataBind(); } }
private void ClearSelect() { OperationManagerList.Clear(); StarManagerList.Clear(); StarList.Clear(); Star = 0; StarManager = 0; OperationManager = 0; CreateManagerSelectListByUserType(); MinUser = GetMinSelectUser(); UserSubType = ZhiBoUtils.GetUserSubTypeByUserType(MinUser.UserType); }
// Use this for initialization void Start() { starList = this.GetComponent <StarList>(); starImages = starList.stars; }