I am building a pagination my mvc project and have follew problem.
I did everything for pagination and now need just pass a page information to view data in view.
I have a user control Pagination:
Pagination.ascx:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Pagination.ascx.cs"
Inherits="PIMP.Web.TestForum....
I'm having trouble when handling the Post request for my controller:
[HttpGet]
public ActionResult Crear()
{
CarreraRepository carreraRepository = new CarreraRepository();
var carreras = carreraRepository.FindAll().OrderBy(x => x.Nombre);
var carrerasList = new SelectList(carreras, "ID", "Nombre");
ViewData["Carreras"] =...
I've been reading Scott Guthrie's post on Passing ViewData from Controllers to Views, but I don't think the lesson is clicking for my specific situation.
(Note: Due to client proprietary restrictions, I can't talk paste the actual code, so I apologize if my made up case is a bit stupid/confusing.)
I have a Controller called ScenarioCon...
I know it's a bad practice to use database in the view. However, I'm also passing the User object and I wonder how I can make it easy to use.
I love the way it works in Ruby On Rails. You just create an @instance_variable in before_filter and call it from the controllers and from the views.
You can't do this in ASP.NET MVC though. So I...
I'm trying to build an ASP.NET MVC 2 application. I want to pass data to a view from a controller. I am able to pass it when it is only a single data structure. In the controller:
private ArticlesDBEntities _db = new ArticlesDBEntities();
public ActionResult Articles()
{
return View(_db.ArticleSet.ToList());
}
an...
I'm pretty new to ASP.Net MVC. I've created a model that fills a List<> with multiple custom objects called "Result". Then, in my controller, I get this List and put it into the ViewData.
I am at a bit of a loss as to how to utilize this List in my view (aspx page). My first try was just to put ViewData["Results"] between the <% %>, ...
I am implementing single sign on and i have the login name and password from the parent site and would like to insert this values in the login and password field of the child site. How can i do this in C#, MVC. as of now i am able to populate the login name using viewdata but i m unable to populate the password.
...
I an ASP.NET MVC we can pass some data via a ViewData and then show it on a page:
<%: ViewData["Foo"]%>
But how to make a hyperlink out of it?
Something like following:
<%: Html.ActionLink(ViewData["Foo"], "Index", "Home") %>
...