Query regarding making the textbox readable?

103 views Asked by At

I have an mvc application in which I want to make the texbox readable,i have used the following syntax it is not working.please tell me where am I going wrong

<%= Html.TextBox("upperlimit", String.Format("{0:F}", Model.upperlimit, new { @readonly = (Model.upperlimit != null ? "readonly" : "false") }))%>
<%= Html.ValidationMessage("upperlimit", "*") %>

Thanks in advance Ritz

1

There are 1 answers

1
Darin Dimitrov On BEST ANSWER

Try this:

<%= Html.TextBox(
    "upperlimit", 
    String.Format("{0:F}", Model.upperlimit), 
    new { 
        @readonly = Model.upperlimit != null ? "readonly" : "false" 
    })
%>