Hi Experts,
I am working on a website (Asp.net mvc), where I have multiple partial views. One of the views is user information and then below there are few other views say books by the user, articles in a given book etc. thats how my controller looks like.
public class UserController : Controller
{
public ActionResult UserInfo(long userid)
{
var model.User = LoadUser(userId);
return View(model);
}
public ActionResult Books(long userId)
{
var model.User = LoadUser(userId);
model.Books = LoadBooks(userId);
return View(model);
}
public ActionResult Articles(long bookId)
{
var model.User = LoadUserByBookId(bookId);
model.Book = LoadBook(bookId);
model.Articles= LoadArticles(bookId);
return View(model);
}
}
I have created three partial views for UserInfo, Books and Articles and pass data from a given view. Now you can see with each method things go more complex. I was reading about Html.Action helper which can load individual partial views. But as you can see I need to pass some data from Html.Action helper to the methods so it can load data accordingly for example to load userinfo, I will need to pass userId.
How can I achieve this using this or any other better method. Help will be appreciated.
Regards Parminder