{"id":745,"date":"2023-06-30T18:21:21","date_gmt":"2023-06-30T09:21:21","guid":{"rendered":"https:\/\/mvc.auctionpro.co.kr\/?page_id=745"},"modified":"2023-06-30T18:21:22","modified_gmt":"2023-06-30T09:21:22","slug":"model-%ec%97%90%ec%84%9c-selectlistitem-%ec%84%a4%ec%a0%95-%ed%95%98%ea%b8%b0","status":"publish","type":"page","link":"https:\/\/mvc.auctionpro.co.kr\/?page_id=745","title":{"rendered":"Model \uc5d0\uc11c SelectListItem \uc124\uc815 \ud558\uae30"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Overview  :  Model \uc5d0\uc11c SelectListItem \uc124\uc815 \ud574\uc11c  View \uc5d0\uc11c \uc0ac\uc6a9\ud558\uae30 <\/h3>\n\n\n\n<h2 class=\"wp-block-heading\">Model <\/h2>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \" >using Microsoft.AspNetCore.Mvc.Rendering;\nusing System.Collections.Generic;\n\nnamespace FormsTagHelper.ViewModels\n{\n    public class CountryViewModel\n    {\n        public string Country { get; set; }\n\n        public List&lt;SelectListItem&gt; Countries { get; } = new List&lt;SelectListItem&gt;\n        {\n            new SelectListItem { Value = \"MX\", Text = \"Mexico\" },\n            new SelectListItem { Value = \"CA\", Text = \"Canada\" },\n            new SelectListItem { Value = \"US\", Text = \"USA\"  },\n        };\n    }\n}<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">View<\/h2>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \" >&lt;select asp-for=\"Country\" asp-items=\"Model.Countries\"&gt;&lt;\/select&gt; <\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Control<\/h2>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \" >public IActionResult Index()\n{\n    var model = new CountryViewModel();\n    model.Country = \"CA\";\n    return View(model);\n}<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"> <\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Overview : Model \uc5d0\uc11c SelectListItem \uc124\uc815 \ud574\uc11c View \uc5d0\uc11c \uc0ac\uc6a9\ud558\uae30 Model View Control<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-745","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=745"}],"version-history":[{"count":1,"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/745\/revisions"}],"predecessor-version":[{"id":746,"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/745\/revisions\/746"}],"wp:attachment":[{"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}