Deepak

Deepak

  • NA
  • 32
  • 118.8k

My ViewBag.JobNo is not working in MVC

Dec 29 2016 11:04 AM

I am using ViewBag.JobNo and it is not working. I am using ViewBag.JobNo in my controller as:

ViewBag.JobNo = "test";

In my View, I am using it as:

@Html.TextBox("txtJobNo", (string)ViewBag.JobNo , new { @class = "col-md-10 form-control" })

I am getting my TextBox empty.

But when I am using ViewBag.Title in place of ViewBag.JobNo, it is working fine.

Please help me, if you have some idea. Thanks..


Answers (6)