开发者

Display a value in a disabled textbox using TextBoxFor

I'm tryin开发者_开发问答g to display a disabled textbox with the value 'FL' in it. Somehow the textbox does not have any value when it is displayed, but it is disabled. How do you display a value in a disabled textbox?

<%= Html.TextBoxFor(model => model.State, new { value="FL", disabled="disabled" }) %>


I think the code:

Html.TextBoxFor(model => model.State, new { disabled="disabled" });

is the code you need.

In the model, set the State = 'FL' & it should work correctly...

HTH.


You may write like this:

<%= Html.TextBoxFor(model => model.State, new { @Value="FL", disabled="disabled" }) %>

"@" need, because value is a reserved world

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜