0

asp:textbox ID="txtQuantity" runat="server" Visible="true" Text*="<%# Eval("quatity","{0:######}")"* />

how will i do this in mvc3 view.

1 Answer 1

1

Use this for flexible text editor with e.g. multiline properties:

@Html.EditorFor(model => model.propertyName)

You can simply add a input box with Html.TextBoxFor and HtmlTextboxFor always creates a textbox (<input type="text" ...). While the EditorFor looks at the type and meta information, and can render another control or a template you supply.

@Html.TextBoxFor(m => m.propertyName)

PropertyName specifies the property value to be displayed in the textbox.

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

1 Comment

You can also use TextBoxFor. Assuming you're using Razor: @Html.TextBoxFor(m => m.propertyName) or when using WebForms <%= Html.TextBoxFor(m => m.propertyName). In this "m" stands form Model, it's a shortcut code.

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.