Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Byte column type - drop down doesn't show correctly
Message
 
 
À
Tous
Information générale
Forum:
Javascript
Catégorie:
Autre
Titre:
Byte column type - drop down doesn't show correctly
Divers
Thread ID:
01606733
Message ID:
01606733
Vues:
51
Hi everybody,

In the view model I have the following:
 [DisplayName("Template Type:")]
        public TemplateTypes TmplType { get; set; }
where the TemplateTypes enum is Byte type (column in the database is tinyint). I tried using byte directly with the same result.

In the form we have the following:
<div class="col-md-8">
                @*@Html.DropDownList("templateTypes", (IEnumerable<SelectListItem>)ViewBag.TemplateTypes, new { @class = "form-control", ng_model = "currentTemplate.tmplType" })*@
                <select class="form-control" name="templateTypes" id="templateTypes"
                        ng-model="currentTemplate.tmplType" 
                        ng-options="t.value as t.text for t in templateTypes"></select>
            </div>
The original commented code worked Ok. The new code has the values in drop down when I open it, but it doesn't correctly show on the form (e.g. drop down shows empty). If I change the value, it does correctly show in the grid after I save, but not in the form - the drop down is still blank.

The same form has few more drop downs and they show everything correctly.

To build the templateTypes we use a special class to convert enums into value and string representation.

Do you see what may be missing here? Could it be the types difference (both value and text are strings)?
     public string Text { get; set; }
        //
        // Summary:
        //     Gets or sets the value of the selected item.
        //
        // Returns:
        //     The value.
        public string Value { get; set; }
Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform