0

I am trying to replace the following html textbox using html helpers for asp.net mvc3 application.

<input name="Name" id="add-student-name" type="text" maxlength="50" />

I tried with the following but on rendering I found it is not matching with the above html markup.

@Html.TextBox("Name", new {id="add-student-name", maxlength="50"})

Can anyone help me to resolve the above issue?

1 Answer 1

2

Add null as the second argument (your html attributes go in as the third argument)

@Html.TextBox("Name", null, new {id="add-student-name", maxlength="50"})

Been a few years since I did asp.net but I'm pretty sure that'll turn out to be your issue.

Sign up to request clarification or add additional context in comments.

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.