本文整理汇总了C#中Microsoft.AspNet.Mvc.Rendering.SelectList类的典型用法代码示例。如果您正苦于以下问题:C# SelectList类的具体用法?C# SelectList怎么用?C# SelectList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SelectList类属于Microsoft.AspNet.Mvc.Rendering命名空间,在下文中一共展示了SelectList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ApportionViewModel
public ApportionViewModel(int selectedMonth, int selectedYear)
{
ApportionItems = new List<ApportionItem>();
AccountOwners = OwnerNames.Owners;
var lstMonths = new List<DateDropdownItem>();
for (int i = 1; i <= 12; i++)
{
lstMonths.Add(new DateDropdownItem { MonthInt = i });
}
var lstYears = new List<int>();
for (int i = 2012; i < 2017; i++)
{
lstYears.Add(i);
}
selectedMonth = selectedMonth > 0 ? selectedMonth : DateTime.Now.Month;
selectedYear = selectedYear > 0 ? selectedYear : DateTime.Now.Year;
Months = new SelectList(lstMonths, "MonthInt", "MonthName");
Years = new SelectList(lstYears, selectedYear);
SelectedMonth = selectedMonth;
SelectedYear = selectedYear;
}
开发者ID:ajithmohann,项目名称:MakeItClear,代码行数:26,代码来源:ApportionViewModel.cs
示例2: Create
// GET: Funcionarios/Create
public IActionResult Create()
{
ViewData["departamentoId"] = new SelectList(_context.Departamentos, "Id", "departamento");
ViewData["empresaId"] = new SelectList(_context.Empresas, "codigo", "empresa");
ViewData["utilizadorId"] = new SelectList(_context.Users, "Id", "utilizador");
return View();
}
开发者ID:gmahota,项目名称:CRM_MIT,代码行数:8,代码来源:FuncionariosController.cs
示例3: Create
// GET: Students/Create
public IActionResult Create()
{
ViewData["FirstNameId"] = new SelectList(_context.Set<FirstName>(), "FirstNameId", "FirstName");
ViewData["LastNameId"] = new SelectList(_context.Set<LastName>(), "LastNameId", "LastName");
ViewData["MidNameId"] = new SelectList(_context.Set<MidName>(), "MidNameId", "MidName");
return View();
}
开发者ID:cornFedir,项目名称:Uni,代码行数:8,代码来源:StudentsController.cs
示例4: Create
// GET: ComicsPersons/Create
public IActionResult Create()
{
ViewData["ComicsId"] = new SelectList(_context.Comicses, "Id", "Comics");
ViewData["PersonId"] = new SelectList(_context.Persons, "Id", "Person");
ViewBag.Category = new SelectList(_context.PersonTypes, "Id", "Title");
return View();
}
开发者ID:LestatDelionkur,项目名称:Comix,代码行数:8,代码来源:ComicsPersonsController.cs
示例5: Create
// GET: Benchmarks/Create
public IActionResult Create()
{
ViewData["ActualReportId"] = new SelectList(_context.ActualReports, "Id", "ActualReport");
ViewData["BenchmarkContainerId"] = new SelectList(_context.BenchmarkContainers, "Id", "BenchmarkContainer");
ViewData["ExpectedReportId"] = new SelectList(_context.ExpectedReports, "Id", "ExpectedReport");
return View();
}
开发者ID:AaronDeSanctis,项目名称:Simpl,代码行数:8,代码来源:BenchmarksController.cs
示例6: Create
// GET: Posts/Create
public IActionResult Create()
{
ViewData["ForumId"] = new SelectList(_context.Forums, "Id", "Name");
ViewData["ReplyToPostId"] = new SelectList(_context.Posts, "ReplyToPostId", "ReplyToPostId");
ViewData["UserId"] = new SelectList(_context.Users, "Id", "UserName");
return View();
}
开发者ID:gdoron,项目名称:Forums,代码行数:8,代码来源:PostsController.cs
示例7: Index
// GET: Movies
public IActionResult Index(string movieGenre, string searchString)
{
fakeData1();
Debug.WriteLine("\n CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC\n searchString = >" + searchString + "<\n movieGenre = >" + movieGenre + "<");
//return View(_context.Movie.ToList());
var GenreQry = from m in movieList
orderby m.Genre
select m.Genre;
var GenreList = new List<string>();
GenreList.AddRange(GenreQry.Distinct());
ViewData["movieGenre"] = new SelectList(GenreList);
Debug.WriteLine("Genre count is " +GenreList.Count);
// var movies = from m in movieList select m;
var movieListShort = from m in movieList select m;
if (!String.IsNullOrEmpty(searchString))
{
movieListShort = movieListShort.Where(s => s.Title.Contains(searchString)); // s => s.Title is a Lambda Expression. This is case sensitive.
}
if(!string.IsNullOrEmpty(movieGenre))
{
movieListShort = movieListShort.Where(x => x.Genre == movieGenre);
}
return View(movieListShort);
}
开发者ID:Spencerinc,项目名称:VS_MvcMovie,代码行数:33,代码来源:MoviesController.cs
示例8: Create
// GET: Expenses/Create
public IActionResult Create()
{
ViewData["FakeTransactionsId"] = new SelectList(_context.FakeTransactions, "Id", "FakeTransactions");
ViewData["TodaysTransactionsId"] = new SelectList(_context.TodaysTransactions, "Id", "TodaysTransactions");
ViewData["TotalTransactionsId"] = new SelectList(_context.TotalTransactions, "Id", "TotalTransactions");
return View();
}
开发者ID:AaronDeSanctis,项目名称:Simpl,代码行数:8,代码来源:ExpensesController.cs
示例9: SaveTransaction
public IActionResult SaveTransaction(QuickTransactionViewModel vm)
{
if (ModelState.IsValid == false)
{
vm.SelectedTransaction = accountsService.GetQuickTransactionDef(long.Parse(vm.SelectedTransaction)).Name;
var accountHeads = accountsService.GetAllAccountHeadsByCurrency(HttpContext.Session.GetString("Currency"));
var accountHeadsList = new SelectList(accountHeads, "AccountHeadId", "Name");
vm.AccountHeads = accountHeadsList;
return View("CreateTransaction", vm);
}
Journal item = new Journal()
{
Amount = vm.Amount,
CrAccountHeadId = vm.CrAccountHeadId,
DrAccountHeadId = vm.DrAccountHeadId,
Narration = vm.Narration,
TransactionDate = vm.TransactionDate,
ModifiedBy = "testuser", // TODO: replace with log in user id
ModifiedDate = DateTime.Now
};
journalService.CreateJournal(item);
return View("TransactionResult", item);
}
开发者ID:ajithmohann,项目名称:MakeItClear,代码行数:28,代码来源:TransactionController.cs
示例10: Index
// GET: Movies
public IActionResult Index(string movieGenre, string searchString)
{
var GenreQry = from m in _context.Movie
orderby m.Genre
select m.Genre;
var GenreList = new List<string>();
GenreList.AddRange(GenreQry.Distinct());
ViewData["movieGenre"] = new SelectList(GenreList);
var movies = from m in _context.Movie
select m;
if (!string.IsNullOrEmpty(searchString))
{
movies = movies.Where(s => s.Title.Contains(searchString));
}
if (!string.IsNullOrEmpty(movieGenre))
{
movies = movies.Where(x => x.Genre == movieGenre);
}
return View(movies);
}
开发者ID:p-murphy,项目名称:MvcMovie,代码行数:26,代码来源:MoviesController.cs
示例11: Index
public IActionResult Index(string currencyCode)
{
var currencies = HttpContext.Session.GetObjectFromJson<List<Currency>>("Currencies");
var curSelVal = currencyService.GetDefaultCurrency().CurrencyCode;
var currencyList = new SelectList(currencies, "CurrencyCode", "CurrencyCode", curSelVal);
var vm = new ChangeCurrencyViewModel(currencyList);
return View(vm);
}
开发者ID:ajithmohann,项目名称:MakeItClear,代码行数:9,代码来源:AdminController.cs
示例12: ChangeCurrency
public IActionResult ChangeCurrency(string currencyCode)
{
var currencies = HttpContext.Session.GetObjectFromJson<List<Currency>>("Currencies");
var curSelVal = currencies.First(x => x.CurrencyCode.Equals(currencyCode)).CurrencyCode;
var currencyList = new SelectList(currencies, "CurrencyCode", "CurrencyCode", curSelVal);
var vm = new ChangeCurrencyViewModel(currencyList);
return View(vm);
}
开发者ID:ajithmohann,项目名称:MakeItClear,代码行数:9,代码来源:HomeController.cs
示例13: Edit
public async Task<ActionResult> Edit(int id)
{
FieldRule fieldRule = await FindAsyncFieldRule(id);
if (fieldRule == null)
{
return HttpNotFound();
}
ViewData["SpiderId"] = new SelectList(ProjectContext.Projects, "Id", "Name", fieldRule.SpiderId);
return View(fieldRule);
}
开发者ID:DubMircea,项目名称:ttt,代码行数:10,代码来源:FieldRuleControllers.cs
示例14: Create
public IActionResult Create(TvProgramEpisode tvProgramEpisode)
{
if (ModelState.IsValid) {
_context.TvEpisodes.Add(tvProgramEpisode);
_context.SaveChanges();
return RedirectToAction("Index");
}
ViewData["TvProgramId"] = new SelectList(_context.TvPrograms, "TvProgramId", "TvProgram", tvProgramEpisode.TvProgramId);
return View(tvProgramEpisode);
}
开发者ID:olliholliday,项目名称:TvList,代码行数:10,代码来源:TvProgramEpisodesController.cs
示例15: Create
public async Task<IActionResult> Create(Comics comics)
{
if (ModelState.IsValid)
{
_context.Comicses.Add(comics);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
ViewData["ParentComicsId"] = new SelectList(_context.Comicses, "Id", "ParentComics", comics.ParentComicsId);
return View(comics);
}
开发者ID:LestatDelionkur,项目名称:Comix,代码行数:11,代码来源:ComicsController.cs
示例16: Create
public async Task<IActionResult> Create(TriviaOption triviaOption)
{
if (ModelState.IsValid)
{
_context.TriviaOption.Add(triviaOption);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
ViewData["QuestionId"] = new SelectList(_context.TriviaQuestion, "Id", "TriviaQuestion", triviaOption.QuestionId);
return View(triviaOption);
}
开发者ID:AngelinaT,项目名称:WebCampTrainingKit,代码行数:11,代码来源:OptionController.cs
示例17: Create
public IActionResult Create(Puzzle puzzle)
{
if (ModelState.IsValid)
{
_context.Puzzle.Add(puzzle);
_context.SaveChanges();
return RedirectToAction("Index");
}
ViewData["ShopId"] = new SelectList(_context.Shop, "ID", "Shop", puzzle.ShopId);
return View(puzzle);
}
开发者ID:sickpres,项目名称:PuzzleAdv,代码行数:11,代码来源:DemoController.cs
示例18: Create
public async Task<IActionResult> Create(Book book)
{
if (ModelState.IsValid)
{
_context.Book.Add(book);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
ViewData["AuthorID"] = new SelectList(_context.Set<Author>(), "AuthorID", "Author", book.AuthorID);
return View(book);
}
开发者ID:ricardodemauro,项目名称:ContosoBooks,代码行数:11,代码来源:BooksController.cs
示例19: Create
public IActionResult Create(TimeTable timeTable)
{
if (ModelState.IsValid)
{
_context.TimeTable.Add(timeTable);
_context.SaveChanges();
return RedirectToAction("Index");
}
ViewData["StationsTableId"] = new SelectList(_context.Set<StationsTable>(), "StationSTableId", "Station", timeTable.StationsTableId);
return View(timeTable);
}
开发者ID:Madhubi,项目名称:TheClosestPkm,代码行数:11,代码来源:TimeTablesController.cs
示例20: Create
public IActionResult Create(FuncInfFerias funcInfFerias)
{
if (ModelState.IsValid)
{
_context.FuncInfFerias.Add(funcInfFerias);
_context.SaveChanges();
return RedirectToAction("Index");
}
ViewData["funcionarioId"] = new SelectList(_context.Funcionarios, "id", "funcionario", funcInfFerias.funcionarioId);
return View(funcInfFerias);
}
开发者ID:gmahota,项目名称:CRM_MIT,代码行数:11,代码来源:FuncInfFeriasController.cs
注:本文中的Microsoft.AspNet.Mvc.Rendering.SelectList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论