如何在mvc 4中将文本框设置为只读? [英] how to make a text box as readonly in mvc 4?

查看:93
本文介绍了如何在mvc 4中将文本框设置为只读?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里我有一个显示日期的文本框,并且它允许用户编辑日期,但我想显示日期,不想给任何一个如何做的编辑选项?br />


< input name =txtSubCommStartDateclass =txtborderid =txtSubCommStartDatetype =text

value =@( Model.NotarySubsequentRecord.CommisionStartDate.ToShortDateString()==1/1/0001|| Model.NotarySubsequentRecord.CommisionStartDate.ToShortDateString()==12/31/9999?:Model.NotarySubsequentRecord.CommisionStartDate.ToString( MM / dd / yyyy))size =8maxlength =10tabindex =15/>





提前感谢

解决方案

< input name =txtSubCommStartDatereadonly class =...

或者用剃须刀

如何制作mvc4文本框readon ly? [ ^ ]

here i have a text box displaying some date in to it and and it allows user to edit the date as well but i wanna show the date and don't wanna give edit option to any one how to do it?

<input name="txtSubCommStartDate" class="txtborder" id="txtSubCommStartDate" type="text"
value="@(Model.NotarySubsequentRecord.CommisionStartDate.ToShortDateString() == "1/1/0001" || Model.NotarySubsequentRecord.CommisionStartDate.ToShortDateString() == "12/31/9999" ? "" : Model.NotarySubsequentRecord.CommisionStartDate.ToString("MM/dd/yyyy"))" size="8" maxlength="10" tabindex="15" />


thanks in advance

解决方案

<input name="txtSubCommStartDate" readonly class="...
or, in razor
how to make mvc4 textbox readonly?[^]


这篇关于如何在mvc 4中将文本框设置为只读?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆