This seems like it should be fairly simple and yet here I am.
I have a grid with inline editing. I have set an editor template for a column to have a dropdown list. This column is bound to a property that is set according to an enum. All of that works great, and I get a dropdown with the names.
However, it always posts to the database as null. All I want is the dropdown to show names when editing, post the value when creating or editing, then display the name when just viewing.
I have scoured forums but continue to come up empty.
Model
public
class
Issue
{
public
int
Id {
get
;
set
; }
...
...
public
Urgency? Urgency {
get
;
set
; }
...
...
}
Enum
public
enum
Urgency
{
Low = 1,
Medium = 2,
High = 3,
Critical = 4
}
EditorTemplate View
@(Html.Kendo().DropDownList()
.Name(
"Urgency"
)
.BindTo(Enum.GetNames(
typeof
(Urgency)).ToList())
)
I have tried many other things but this is where my code is at the moment.
What am I missing?