1

I have written this:

@Html.TextBox("PhoneAdmin", new { id = "phone" })

My goal was to have the id of "phone" for this textbox because a jQuery plugin I downloaded to use is using that ID as a masked text box to format phone numbers.

But it is not working, if I go to "Inspect" on it, I will see this:

<input id="PhoneAdmin" name="PhoneAdmin" type="text" value="{ id = phone }">

and it shows up like this in the browser:

enter image description here

What did I do wrong?

2
  • @E.B : Ok I tired..no change, still the same. Commented Apr 18, 2016 at 18:56
  • 1
    sorry, no need for "@", just check the answer. I'll open project and find a sample :D Commented Apr 18, 2016 at 18:58

1 Answer 1

2

here is what I did somewhere I needed this:

@Html.ActionLink(task.Name, "Details", new { id = task.Id })

you just must find the correct constructor.

and here is what you want:

@Html.TextBox("PhoneAdmin", "+355699abc",new {id="phone" })
Sign up to request clarification or add additional context in comments.

1 Comment

Ok that's what I should have written: @Html.TextBox("PhoneAdmin", null ,new { id = "phone" }) your comment about using the the right constructor helped.

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.