1
How do I call a view by passing a parameter?
Type, if parametro = 1 <h1>Teste1</h1> else <h1>Teste2</h1>
1
How do I call a view by passing a parameter?
Type, if parametro = 1 <h1>Teste1</h1> else <h1>Teste2</h1>
1
By answering the question : How to send 2 objects from Controller to View in C# ASP.NET MVC?, do the following
In his controller:
public ActionResult View()
{
ViewBag.Parametro = 1;
return View();
}
And in your View:
@if (((int)ViewBag.Parametro) == 1) {
<h1>Teste1</h1>
} else {
<h1>Teste2</h1>
}
Browser other questions tagged c#
You are not signed in. Login or sign up in order to post.