asp.net mvc select change redirect to Action
Posted
by mazhar kaunain baig
on Stack Overflow
See other posts from Stack Overflow
or by mazhar kaunain baig
Published on 2010-06-16T07:09:34Z
Indexed on
2010/06/16
7:12 UTC
Read the original article
Hit count: 298
I am correctly passing the action name from the Controller to the paging class and then using select list i want to redirect to that action. at this moment it is appending to the current url.i want the correct way of redirecting to the controller action manageUser using select list below
What should we have here in Model.COntroller . ControllerName/ActionName/ or Just ActionName
<select id="paging" onchange="location.href='<%= Model.Controller %>'+this.value">
<% for (int i = 1; i <= Model.TotalPages; i++)
{ %>
<option id=<%=i %>><%=i %></option>
<% } %>
</select>
public class PaginatedList<T> : List<T>
{
public string Controller { get; private set; }
public PaginatedList(IQueryable<T> source, int pageIndex, int pageSize,string Cont)
{
Controller = Cont; // here is the controller
}
}
Controller
public ActionResult ManageUser(int? page)
{
const int pageSize = 5;
var AllUser = UserRepository.GetAllUser();
var paginatedUsers = new PaginatedList<Users>(AllUser, page ?? 1, pageSize,"ManageUser/Page/");
return View(paginatedUsers);
}
© Stack Overflow or respective owner