如何使用MVC 5在文本框中显示默认值 [英] How to display the default value in textbox using MVC 5

查看:81
本文介绍了如何使用MVC 5在文本框中显示默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





你能帮我解决下面的问题。

如何使用mvc 5在文本框中显示默认值,该默认值应保存在数据库中。没有持有者的价值。



谢谢。



我尝试过:



如何使用mvc 5在文本框中显示默认值,该默认值应保存在数据库中。不是占位符值。

Hi,

Could you please help me on below query.
How to display default value in text box using mvc 5, that default value should be save in database. not place holder value.

Thank you.

What I have tried:

How to display default value in text box using mvc 5, that default value should be save in database. not place holder value.

推荐答案

You can use the annotaion property

class Person {
    [DefaultValue (18)]
    public int Age { get; set; }
}


这篇关于如何使用MVC 5在文本框中显示默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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