Pass a simple string from controller to a view MVC3

前端 未结 6 1705
青春惊慌失措
青春惊慌失措 2021-01-31 02:19

I know this seems pretty basic, and it should be, but I cant find out where I am going wrong. (I hve read other articles with similar titles on SO, and other resources on the we

6条回答
  •  迷失自我
    2021-01-31 03:07

    Use ViewBag

    ViewBag.MyString = "some string";
    return View();
    

    In your View

    @ViewBag.MyString

    I know this does not answer your question (it has already been answered), but the title of your question is very vast and can bring any person on this page who is searching for a query for passing a simple string to View from Controller.

提交回复
热议问题