Hi,@Arnab
As you said,you need to hard code it.But it is hard to use Code first Migration to add a dropdown like this by default,so you can try to add the following code to your page.
<select asp-for="Requeststatus">
<option value="Active">Active</option>
<option value="In Progress">In Progress</option>
<option value="Resolved">Resolved</option>
<option value="Closed">Closed</option>
<option value="Waiting">Waiting</option>
</select>
Or you can try to set List<SelectListItem>
type data in cshtml.cs file,and use asp-items
in the dropdown:
[BindProperty]
public List<SelectListItem> RequeststatusList { get; set; }
public void OnGet()
{
List<string> l = new List<string> { "Active", "In Progress", "Resolved", "Closed", "Waiting" };
RequeststatusList = l.Select(x => new SelectListItem { Text = x, Value = x }).ToList();
}
cshtml:
<select asp-for="Requeststatus" asp-items="@Model.RequeststatusList"></select>
----------
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best Regards,
Yiyi You