.net MVC 5提交后使用C#禁用文本框 [英] .net MVC 5 disable textbox using C# after submit

查看:88
本文介绍了.net MVC 5提交后使用C#禁用文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在回发提交后禁用或将文本框设置为只读。

我需要控制器在视图中禁用剃须刀文本框的代码。

请不要建议使用jquery让我熟悉mvc谢谢。



我尝试过:



i默认情况下可以执行此操作,但无法控制c#控制器中文本框的属性。

< input id =Namename =Nametype =textvalue =@ Model.listovariableclassdisabled =disabled

解决方案

MVC是一种服务器端技术,你不能用它来动态修改浏览器中的DOM,所以我担心你不得不使用javascript或jQuery来做这件事。 / BLOCKQUOTE>

Im having trouble disabling or set textbox to readonly after postback submission.
what code do i need from controller to disable a razor textbox in views.
please dont suggest to use jquery for me to familiarize mvc thanks.

What I have tried:

i can do this by default but cant control the properties of the textbox in the c# controller.
<input id="Name" name="Name" type="text" value="@Model.listovariableclass" disabled="disabled"

解决方案

MVC is a server-side technology, you can't use it to dynamically amend the DOM in the browser, so I'm afraid you're going to have to use javascript or jQuery to do this.


这篇关于.net MVC 5提交后使用C#禁用文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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