Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hockey = new hockeyEntities();

            if (!IsPostBack)
            {
                var teams = from team in hockey.TEAMS
                            select new
                            {
                                team.TEAMID,
                                team.NAME
                            };
                DropDownList1.DataValueField = "TEAMID";
                DropDownList1.DataTextField = "NAME";
                DropDownList1.DataSource = teams.Distinct().OrderBy(t => t.NAME);
                DataBind();
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hockey = new hockeyEntities();

            if (!IsPostBack)
            {
                var teams = from team in hockey.TEAMS
                            select new
                {
                    team.TEAMID,
                    team.NAME
                };
                DropDownList1.DataValueField = "TEAMID";
                DropDownList1.DataTextField  = "NAME";
                DropDownList1.DataSource     = teams.Distinct().OrderBy(t => t.NAME);
                DataBind();
            }
        }