当前位置: 首页>>代码示例>>C#>>正文


C# SelectList.First方法代码示例

本文整理汇总了C#中System.Web.Mvc.SelectList.First方法的典型用法代码示例。如果您正苦于以下问题:C# SelectList.First方法的具体用法?C# SelectList.First怎么用?C# SelectList.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.Mvc.SelectList的用法示例。


在下文中一共展示了SelectList.First方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: testRolesSelect

        public void testRolesSelect()
        {
            IMembershipRepository m = new MembershipRepository();

            SelectList sl = new SelectList(m.getAllRoles());

            Assert.AreEqual(sl.First().Text, "hello");
        }
开发者ID:unepwcmc,项目名称:sigtrade,代码行数:8,代码来源:MembershipTest.cs

示例2: GetSubjectNameById

 public static string GetSubjectNameById(int id)
 {
     var select = new SelectList(
         SubjectList,
         "value",
         "text",
         0);
     return select.First(x => Convert.ToInt32(x.Value) == id).Text;
 }
开发者ID:TotzkePaul,项目名称:iTotzke,代码行数:9,代码来源:ContraClass.cs

示例3: MenuViewModel

 public MenuViewModel(User user)
 {
     Pools = new SelectList(user.GetPools(),"Id","Name").ToList();
     Teams = new List<Team>();
     //foreach (var pool in user.GetPools())
     //    Pools.Add(new SelectListItem() { Text = pool.Name, Value = pool.Id.ToString() });
     if (Pools.Count != 0)
     {
         SelectedPoolId = Int32.Parse(Pools.First().Value);
         Teams = new ApplicationDbContext().TeamsByPoolID(SelectedPoolId);
     }
 }
开发者ID:handsofstone,项目名称:hp,代码行数:12,代码来源:MenuViewModel.cs

示例4: testAllCommittees

        public void testAllCommittees()
        {
            IGenericRepository generic = new GenericRepository();
            IMeetingLibRepository mlib = new MeetingLibRepository();
               // IList<TblMeetingLib> coms = generic.getAllMeetings();

            //IList<SelectItems> items = generic.getAllCommitteesSelect();

            IList<SelectItems> items = generic.getAllMeetingsSelect();

            IList<MeetingLib> itemsm = mlib.getAllMeetingLibs();
            SelectList sl = new SelectList(itemsm, "MeetingLibID", "MeetingLibDesc");

            Assert.AreEqual(sl.First().Text,"hello");
        }
开发者ID:unepwcmc,项目名称:sigtrade,代码行数:15,代码来源:MeetingLibTest.cs

示例5: ManageSiteCategories

        public ActionResult ManageSiteCategories(string tenantTypeId)
        {
            IUser currentUser = UserContext.CurrentUser;
            if (currentUser == null)
                return HttpNotFound();
            var authorizer = DIContainer.Resolve<Authorizer>();

            pageResourceManager.InsertTitlePart("站点类别管理");

            List<TenantType> managedTenantTypes = new List<TenantType>();
            IEnumerable<TenantType> allTenantTypes = tenantTypeService.Gets(MultiTenantServiceKeys.Instance().SiteCategory());

            foreach (var tenantType in allTenantTypes)
            {
                if (authorizer.IsAdministrator(tenantType.ApplicationId))
                {
                    managedTenantTypes.Add(tenantType);
                }
            }
            SelectList tenantList = new SelectList(managedTenantTypes.Select(n => new { text = n.Name, value = n.TenantTypeId }), "value", "text", tenantTypeId);

            if (string.IsNullOrEmpty(tenantTypeId))
            {
                tenantTypeId = tenantList.First().Value;
            }
            IEnumerable<Category> categorys = categoryService.GetOwnerCategories(0, tenantTypeId);

            ViewData["tenantList"] = tenantList;
            ViewData["tenantTypeId"] = tenantTypeId;
            return View(categorys);
        }
开发者ID:hbulzy,项目名称:SYS,代码行数:31,代码来源:ControlPanelContentController.cs


注:本文中的System.Web.Mvc.SelectList.First方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。