MVC中Html.EditorFor宽度及高度怎么设定

因为是转载文章 在此标明出处,以前有文章是转的没标明的请谅解,因为有些已经无法找到出处,或者与其它原因。

如有冒犯请联系本人,或删除,或标明出处。

因为好的文章,以前只想收藏,但连接有时候会失效,所以现在碰到好的直接转到自己这里。

原文 出处http://www.myexception.cn/asp-dotnet/551537.html



MVC中Html.EditorFor宽度及高度如何设定?
Html.EditorFor中如何设定高度及宽度,<%: Html.EditorFor(model => model.Content)%>
如何生成像这样的格式:<textarea name="textarea" id="textarea" cols="45" rows="5"></textarea>

<%: Html.EditorFor(model => model.Content, new { @style="width:200px;height:150px"}})%>我这样设定不起作用,只用Html.TextBoxFor有效。

------解决方案--------------------
帮你看了下Html.EditorFor的方法签名:
http://msdn.microsoft.com/en-us/library/system.web.mvc.html.editorextensions.editorfor.aspx
其中并没有类似Html.TextAreaFor的Object htmlAttributes参数
我在生成textarea的时候,是这样用的:

C# code
<%=Html.TextAreaFor(Model => Model.PrjFundsInfo, new { rows = "8", style = "width:99%" })%>

------解决方案--------------------
<%= Html.EditorFor(model => model.Content, new { width="200px",height="150px"})%>
------解决方案--------------------
探讨
<%= Html.EditorFor(model => model.Content, new { width="200px",height="150px"})%>

------解决方案--------------------
哥们。。。仔细看方法签名啊,如果像7楼这样写:
C# code
<%= Html.EditorFor(model => model.Content, new { width="200px",height="150px"})%> 

   
   

   
   

   
   

 添加自定义样式

@Html.Label(Model.StoreMoney.ToString(),new {@class="balanceValue"})

添加属性

@Html.Label(Model.StoreMoney.ToString(),new {@style="width:30px;"})


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值