English 中文(简体)
缩略语
原标题:TextBoxFor in EditorTemplate or DisplayTemplate

In our project we are using TextBoxFor in many places. We would like to set the height and width of the TextBoxFor wherever we have used, for that we have done this.

<%= Html.TextBoxFor(x => x, new { @class = "TextBoxFor" } ) %>  


.TextBoxFor
{
    height:30px;
    width:250px; 
    font-family:@Batang;   
    font-size:20px; 
    font-weight: bold;
}

有可能将<代码>和t;%=Html.TextBoxFor(“”)、新的{@class = “TextBoxFor”} %>在编辑/显示Template和我们刚才呼吁的其他地点的某些地方

<%= Html.TextBoxFor(x => x) %> 

Which means we are not specifying the css class name. So it is easy to maintain. Any ideas. Thanks

最新消息说,我设立了一个静态帮助者,但也有错误。

public static MvcHtmlString CustomTextBoxFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, object htmlAttributes) 
{ 
  return htmlHelper.CustomTextBoxFor<TModel, TProperty>(expression, new { @class = "TextBoxFor" }); 

}



<%: Html.CustomTextBoxFor(m => m.Name) %> 

任何想法?

最佳回答

是的,但你也可以自己创造。 Html helper, 然后是Html。 MyTextBoxFor(......)。

您可以下载MVC3Futures文档,并包括可放在你的手里的缺省模板的模板模板模板模板模板。 你们可以把这些内容编辑成文法。 然而,您必须使用@Html.EditorFor(......),而不是TextBoxFor()。 众所周知,这将影响到安装模板所涉范围的所有编辑用途。

顺便说一句,如果你重新使用MVC3,我强烈建议使用Razak发动机而不是WinForms发动机。 它减少了打字量,提高了效率,其特征是,你不会再回到温树中去,它抑制了温森林的思维。

问题回答

如果你想对所有文本投入领域采用风格,那么你就可以修改与多指标类集调查模板有关的风格。

input[type="text"]
{
    border: 1px solid #ccc;
    padding: 2px;
    font-size: 1.2em;
    color: #444;
}




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签