I'm new to ASP.NET MVC 3 and looking to upgrade our website from other tools to asp.net mvc 3. In current scenario, I have Products which are user specific and each product have Primary Category, Category and Sub Category. When the User logins in, user can only view the products applicable to him (with paging). On the lefthandside navigation menu, it shows PrimaryCategory as ComboBox and Category and SubCategory as TreeView underneath (the navigation section only displays the Primary/Categories/SubCategories for the products applicable to user). This navigation menu is get displaued on every page (i.e on Master Page) so that user can switch to any Cat/SubCat easily.
I have follwoing questions relating to the Navigation Menu and Paging (listing of products).
Using MVC 3 (Razor View Engine) How can I fill the Navigation section with Primary Categories(ComboBox), Category/SubCategory as Tree View on MasterPage? Is there any controls available for these or I just need to do it using the html+css?
What would be the URL syntax and Route Mapping for this. Do I need to pass the PrimaryCat, Cat , SubCat Ids and PageNumber as mapping (i.e /products/1/2/3/1 to every URL or just the PageNumber and querystring parameters (/products/1?PCat=1&Cat=2&SubCat=3).
When the user selects any Category/SubCategory, in Content section how can I show the products as datagrid with paging. Again Is there any control for datagrid?
I have another section on MasterPage(ShoppingBasket) where I display the the items added in the basket by user so I want to update that section as well when the user clicks on add button from the datagrid without refreshing the whole page.
I have read the tutorials from Scott on Asp.net website regarding passing data to MasterPage using the Abstract Controller and going to use that unless 开发者_高级运维if someone have different idea better than that.
Any response would be much appreciated. Thanks in advance
Regards Jhelumi
Most of your questions are user-interface related and there are various ways to solve them.
Question 1 ; Yes, you'll need to do the rendering yourself. Or you can dump the categories into a JavaScript array and use a plugin like jQuery Treeview Plugin to do the rendering on the client side.
Question 2 ; It could work either way. So it's up to you.
Question 3 and 4 are, of course, possible. But they are too broad, so it's difficult to give a definite answer. If you ask for a specific example, I can try to provide some sample code.
Anyway, I suggest trying to forget about datagrid or any other server-side controls. One of the great things about ASP.NET MVC is that you have complete control over the response that is sent from the server to the client. You just give the model to the view (if it needs any), and that view is responsible for how that information is displayed to the user.
精彩评论