在asp.net MVC中设置Html.textbox样式

sum*_*man 3 c# asp.net-mvc twitter-bootstrap bootstrap-modal

我试图给文本框赋予风格,但它现在正在工作.这是我到目前为止所做的.

<div class="modal fade" id="signin_modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class=" modal-header">
                Create An Account
            </div>

            <div class="modal-body">

            @using(Html.BeginForm())
            { 
                <table class="signin_tbl">    
                    <tr>
                        <td class="signin_txt"><h5>Email</h5></td>
                        <td>@Html.TextBox("Name", new { style=" height:70px; "} )  </td>
                    </tr>
                    <tr>
                        <td class="signin_txt">Password</td>
                        <td class="signin_tb" >@Html.TextBox("password") </td>
                    </tr>
                </table>
            }
            </div>
Run Code Online (Sandbox Code Playgroud)

这就是我得到的输出:

在此输入图像描述

Yeh*_*hia 10

您必须将文本框值设置为您的值,然后是您的html属性,如:

@Html.TextBox("Name",[Value Or Null], new { @style=" height:70px; "} )
Run Code Online (Sandbox Code Playgroud)


Kar*_*sla 7

改变你的@Html.TextBox(),如下所示:

@Html.TextBox("Name", null ,new { style=" height:70px; "} )
Run Code Online (Sandbox Code Playgroud)

的第二个参数@Html.TextBox()valuetextbox,不htmlattributes.