I wanted to set a data into the html textbox. I’ve tried this code:
@Html.TextBox("LastName", @value = @ViewBag.FBUserLastName, new { @style = "width: 300px;", @id = "LastName" })
Unfortunately, it showed an error.
I’ve based that code from this
Value not set via ViewData dictionary
Try this
You don’t need the
@value.Also, you don’t need the
@in front ofViewBag, because since you’ve already called@Html.TextBox, it is already looking for code.You also apparently need to cast the ViewBag property to a string.