'Why does select2 return null?

I have a class "MetaKeyword" and an a class "Article", which has a List MetaKeywords atributes. These metakeywords are stored in db and users select them for their articles via select2 in html. But this article atribute returns null, even though rawValue in ModelState has values. Here's my controller code:

[HttpGet]
public IActionResult Create(Guid Id)
{
    var article = new Article();
    var Page = _dataManager.Pages.GetPageById(Id);
    var Blog = _dataManager.Blogs.GetBlogById(Id);

    ViewBag.KeywordId = new SelectList(_dataManager.MetaKeywords.GetMetaKeywords(), "Id", "Name");

    if ((Page == null) && (Blog == null))
        return NotFound();
    else 
        return View(article);
}
[HttpPost]
public IActionResult Create(Article article, IFormFile titleImageFile)

I didn't list HtppPost action here as it may not help in solving the issue And that's my html part resposible for MetaKeywords:

    <div>
        <label asp-for="MetaKeywords" class="control-label">Keywords</label>
        <select asp-for="MetaKeywords" id="metakeyword" name="metakeywords" style="width:250px" multiple [email protected]>
            <option value=""> -- Select MetaKeywords --</option>
        </select>
    </div>

Also a script:

<script type="text/javascript">
    jQuery.noConflict()(function ($) {
    $(document).ready(function() {
        $('#metakeyword').select2({
            allowClear: true
        });
    });
    });
</script>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source