3

I am trying to give style to the textbox but its now working.This is what i have done so far.

<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>

And this is what i am getting as output:

enter image description here

1
  • 2
    have you tried anything yourself to solve the problem before posting here? Commented Sep 15, 2014 at 10:39

3 Answers 3

12

You must set textbox value to your value and followed by your html attribute like:

@Html.TextBox("Name",[Value Or Null], new { @style=" height:70px; "} )
Sign up to request clarification or add additional context in comments.

Comments

7

Change your @Html.TextBox() as shown below :

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

The second parameter of @Html.TextBox() is value of textbox and not htmlattributes.

Comments

3

Specify you want to specify the htmlAttributes argument of the TextBox method instead of it's content. You can specify the argument passed in to the method like this:

@Html.TextBox("Name", htmlAttributes: new { style=" height:70px; "} )

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.