本文整理汇总了C#中Microsoft.AspNet.Mvc.Rendering.SelectList.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# SelectList.Insert方法的具体用法?C# SelectList.Insert怎么用?C# SelectList.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.AspNet.Mvc.Rendering.SelectList
的用法示例。
在下文中一共展示了SelectList.Insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Index
// GET: TestRunnerGroups
public IActionResult Index()
{
ViewData["Message"] = HttpContext.Session.GetString("Message");
HttpContext.Session.Remove("Message");
var trg = new TestRunnerGroupsAndNewTestRunnerGroupAndProjectsAndFoldersAndGroupsAndRuns();
trg.TestRunnerGroups = _context.TestRunnerGroup;
trg.TestRunnerGroup = new TestRunnerGroup();
trg.Projects = _context.Project;
trg.Folders = _context.Folder;
trg.Groups = _context.Group;
trg.Runs = _context.Run;
var BlankSelectListItem = new SelectListItem { Text = "", Value = null };
var projects = new SelectList(_context.Project, "ID", "Name").ToList();
projects.Insert(0, BlankSelectListItem);
ViewBag.Projects = projects;
var folders = new SelectList(_context.Folder, "FolderID", "Name").ToList();
folders.Insert(0, BlankSelectListItem);
ViewBag.Folders = folders;
var groups = new SelectList(_context.Group, "GroupID", "Name").ToList();
groups.Insert(0, BlankSelectListItem);
ViewBag.Groups = groups;
var runs = new SelectList(_context.Run, "RunID", "Name").ToList();
runs.Insert(0, BlankSelectListItem);
ViewBag.Runs = runs;
return View(trg);
}