Can you make DropDownList "readonly" equal to TextField [closed]

-2

I understand that DropDownList is already readonly , since I can not change the values of the options, however I need to maintain the uniform behavior of the screen.

In query mode I can assign a readonly to TextBox and the text is selectable (with double click ) but unalterable. I want to allow the user to also select the text of DropDownList , so I can not assign disabled to the field.

@Html.DropDownListFor(m => m.MeuValor, Model.MinhaLista, width: 100, renderContainer: false, showDisplayName: false, tipoUnidadeHtml: TipoUnidadeHtml.Porcentagem)

This is my code. I can not add (object)new { @disabled = "disabled" }) because there the double click does not work.

    
asked by anonymous 10.01.2017 / 15:44

1 answer

3

I think what you want is not possible.

Coming back to the comment I had already made because it did not simply show the value that the customer selected? Add a field in the model that returns to View with value of dropdown instead of key .

@Html.ValueFor(m => m.MeuValorString)

and if you need to submit the form , and do not lose this value. Adds Key to hiddenfor

@Html.HiddenFor(m => m.MeuValor)
    
10.01.2017 / 17:45