MVC和EditorFor宽度 [英] MVC and EditorFor width

查看:169
本文介绍了MVC和EditorFor宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以设置EditorFor控制的宽度,在我查看?

Can I set the width of an EditorFor control on my View?

我已经设置了几个参数:

I have set a few parameters:

        [Required, DisplayName("Payee Name"), StringLength(50)]
    public string Name { get; set; }

不过,我似乎无法设置获取呈现文本框的宽度。

However, I can't seem to set the width of the textbox that gets rendered.

<table width="300" border="0" cellpadding="3" cellspacing="0">
    <tr>
        <td>
            <%=Html.LabelFor(m => m.Name)%>
        </td>
        <td>
            <%=Html.EditorFor(m => m.Name)%>
        </td>
    </tr>

可以这样做不知何故?

Can this be done somehow?

我试过:

<%=Html.EditorFor(m => m.Name, new {width=50)%>

但没有喜悦...

But no joy...

推荐答案

这有什么错用CSS风格你控制宽度?

What's wrong with using CSS to style your control width?

这篇关于MVC和EditorFor宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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