Sep 25, 2012, 4:43 AM
MVC 3 Razor - How to fill Html.X().MultiCombo with an enum
Hi all,
What is the best way to fill a Html.X().MultiCombo with an enum.
how do i define the store reader for an enum?
My enum looks likem this
Regards
Ish
What is the best way to fill a Html.X().MultiCombo with an enum.
how do i define the store reader for an enum?
My enum looks likem this
public enum ServiceStatus
{
Undefined = 1,
InDelivery = 2,
Testing = 3,
Operational = 4,
Degraded = 5,
Cancelling = 6,
Archived = 7,
InOrder = 8
}
UI Code
Html.X().MultiCombo()
.FieldLabel("Status")
.LabelAlign(LabelAlign.Top)
.ID("mcbBillingStatus")
.Margins("0 0 0 0")
.LabelWidth(200)
.Width(400)
.EmptyText("--- Please Select ---")
.EmptyValue("-1")
.Cls("form-label")
.Items(items =>
{
items.Add(new ListItem()
{
Text =ServiceStatus.Billing.ToString(),
Value = ((int)ServiceStatus.Billing).ToString()
});
items.Add(new ListItem()
{
Text = ServiceStatus.CeasedBilling.ToString(),
Value = ((int)ServiceStatus.CeasedBilling).ToString()
});
}));
Im not happy about the above code and how do i define the store reader for an enumRegards
Ish
Last edited by Daniil; Oct 25, 2013 at 12:59 PM.
Reason: Please use [CODE] tags