I want to create a listbox which should be blank initially. But I getting error
System.InvalidOperationException: 'There is no ViewData item of type >>'IEnumerable' that has the key 'rightSelectednumbers'.'
I have not written any controller code for this. Initially, I just want to create it. Anyone please guide me where I am going wrong?
Class
public class NumberClass
{
public IEnumerable<SelectListItem> rightnumbers { get; set; }
public IEnumerable<int> rightSelectednumbers { get; set; }
}
View
Please have a look View
{
<div class="col-md-6" style="font-family:Arial">
@Html.ListBoxFor(m => m.rightSelectednumbers, Model.rightnumbers, new { @class = "listBox" })
<input type="submit" value="move right" />
</div>
}
Try it this way: