Echo in MVC ASP

0

Hi, I'm trying to call a controller method at a glance, this is working on MVC ASP. The detail is that I need what I have in that function to print it in the view; in PHP with just placing an echo after a function prints it to me, for example Echo $ roles-> g_name zone ($ row ['idUser']); but in MVC I have no idea. The following is the method that I have in the controller:

public void InnerJoinTratamientos(int id) {

   _CD.InnerJoinTratamientos(id);

}

and in the view I'm calling it like this:

<td>

@{ Response.Write(_tr.InnerJoinTratamientos(item.idTratamiento))}

</td>

the instance is done and everything else. Thanks for the help in advance! I hope you have explained me well

    
asked by Anthony 06.02.2017 в 03:46
source

1 answer

0

The simplest and most basic way to do what you want would be to use the ViewBag object as follows.

public ActionResult Index() { Mostrar(); return View(); }

public void Show () {     ViewBag.title="Index";         }

and in your sight ...

@ViewBag.Title

now there are endless ways to do the same, but without more detail we can not help you better

    
answered by 04.03.2017 в 03:18