本文整理汇总了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");
}
示例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;
}
示例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);
}
}
示例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");
}
示例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);
}