0

I want to set the value of a text box to a ViewBag item. Why doesn't the code below work?

@Html.TextBox("UName", @ViewBag.UName)
Erik Schierboom
  • 16,301
  • 10
  • 64
  • 81
Aparan
  • 1,263
  • 3
  • 12
  • 17

1 Answers1

2
@Html.TextBox("UName", (string)ViewBag.UName)
Mohsen Najafzadeh
  • 411
  • 1
  • 6
  • 12