Guest User

Guest User

  • Tech Writer
  • 515
  • 46k

About MVC view and DataBinding from SQL

Feb 15 2021 10:58 AM
hello,
I have view with textbox and I have given @Value to that textbox as 15 by default. Please refer textbox below : 
 
@Html.TextBoxFor(Model => Model.quantity, new { @id = "txtquantity", @type = "number", @class = "form-control", @Value = "15" }) 
 
I am able to save that or any other value in SQL DB.
 
But when I edit that textbox, it should bind the value which is saved in a database, but still it binds that by default "15" value, even in db the value is saved different.
 
Anything can be done to make this work?
Thank you in advance! 

Answers (12)