Hi @AppDev,
From your code it looks like you are specifying the DropDownListFor as "Resolved",
you don't need to specify a default value, just set Selected = true.
.Selected = True
Demo
@ModelType VBDemo.Status
@Html.LabelFor(Function(model) model.STATUS_DESC)
@Html.DropDownListFor(Function(model) model.STATUS_DESC, CType(ViewBag.CodeStatusList, List(Of SelectListItem)))
@Html.ValidationMessageFor(Function(model) model.STATUS_DESC, "", New With {.class = "text-danger"})
Function Index() As ActionResult
ViewBag.CodeStatusList = GET_CODE_STATUS_List1()
Return View()
End Function
Function GET_CODE_STATUS_List1()
Dim STATUS_LIST = (From s In db.status Select New SelectListItem With {
.Text = s.STATUS_DESC,
.Value = s.ST_ID.ToString(),
.Selected = True
}).ToList()
Return STATUS_LIST
End Function
Public Class Status
<Key()>
Public Property ST_ID() As Integer
Public Property STATUS_DESC() As String
End Class
Best regards,
Lan Huang
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.