Pradeep Yadav
What is difference between HTML.TEXTBOX and HTML.TEXTBOXFOR?
By Pradeep Yadav in ASP.NET on Jul 02 2017
  • Pradeep Yadav
    Jul, 2017 2

    Both Of them provide same output, however HTML.TEXTBOXFOR is strongly type and HTML.TEXTBOX is not.

    • 2
  • Bharathi Raja
    Jun, 2018 21

    The TextBoxFor is a newer MVC input extension introduced in MVC2.The main benefit of the newer strongly typed extensions is to show any errors / warnings at compile-time rather than runtime.

    • 1
  • Bharathi Raja
    Feb, 2018 6

    The typed TextBoxFor will generate your input names for you. This is usually just the property name but for properties of complex types can include an underscore such as 'customer_name' Using the typed TextBoxFor version will allow you to use compile time checking. So if you change your model then you can check whether there are any errors in your views.

    • 1
  • Rajeev Kumar
    Mar, 2023 31

    Both is use to create textbox but HTML.Textbox is loosly type means we can pass any name whatever we want i.e HTML.TextBox(“ABC”) but in case of HTML.TextBoxFor we must use the property which are available in particular model suppose you create one model like Customer and that contains 3 properties like Firstname , Lastname and MiddleName so in this case in our view we can use this 3 properties only , if we try to pass another property like HTML.TextBoxFor(m=>m.Age) will throws an error because we are trying to create textbox for age property which is not available in our model

    • 0
  • Dhara Patel
    Nov, 2019 18

    - HTML.TEXTBOX: when we have not use model class. - HTML.TEXTBOXFOR: when we have use model class.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS