ASP.NET MVC Areas localization - asp.net

I have an ASP.NET 3 MVC site with areas. The structure is like this:
Areas
Products
Views
Advanced Search
Detail
Great Products
Views
Advanced Search
Detail
Currently I can access this:
www.domain.com/Products/AdvancedSearch
www.domain.com/GreatProducts/Detail
Now we need to internationalise the routing. I want to achieve this:
[English]
www.domain.com/Products/AdvancedSearch
www.domain.com/GreatProducts/Detail
[Portuguese]
www.domain.com/Produtos/PesquisaAvancada
www.domain.com/GrandesProdutos/Detalhe
I was able to follow this great article:
but currently does not support areas.
Can areas support localization? Can you give me some hint to solve this issue?
Thanks.

You will have to dig into the routing and use localization at that label to get the desired functionality.
See ASP.NET MVC - Localization route

It looks like you create a new controller for each language. We can do that like
[English]
www.domain.com/en/Products/AdvancedSearch
www.domain.com/en/GreatProducts/Detail
[Portuguese]
www.domain.com/por/Produtos/PesquisaAvancada
www.domain.com/por/GrandesProdutos/Detalhe
So I think we can be easier to modify the View Engine to localisation.

Related

CSS Template and visual studio MVC project

So I've downloaded some CSS templates to help make my website look nicer. I have an MVC 3 project for my final year of study, and I don't want it to look like the same generic MVC layout that everyone is using. Is it possible to easily integrate a template or are there special MVC templates out there?
Is it possible to easily integrate a template ?
Yes, surely. Just change the code in views with respective HTML. You can see this video for more details.

incorporate a html-css template as master page in asp.net- mvc 4

I am building a website, and want to do it using MVC 4. I dont want to use the custom asp.net template, and the asp.net templates available online do not meet my requirements. I have designed a html-css template and need to incorporate it into my project...(pretty much build the "contents folder" of the default templated mvc 4 project myself, if u know what i mean)...
I would really appreciate if someone points me to a tutorial or gives me a step-by-step account of how to do it.
You're pretty much looking for how to use Layouts and Sections with Razor. You can have as many as you'd like.
If I'm understanding correctly, you simply want to apply your template to _Layout.cshtml. This is similar in purpose to a MasterPage in ASP.NET web forms.
Here's a ScottGu blog on layouts and sections. (Just noticed that's the same link provided by #ErikPhilips)
To provide a simple explanation. _Layout.cshtml resides at Project\Views\Shared\_Layout.cshtml. By default it looks like a normal HTML file with a couple of unusual lines. The most important being #RenderBody(). When returning a ViewResult from an action (e.g. return View("MyView, myModel)), your view gets rendered by #RenderBody inside the layout. You can do what you like with _Layout.cshtml and if you're brave, you can also nest layouts.

ASP.NET Web Pages, WebForms or MVC?

I am thinking about using on of the technologies mentioned in the title but I can't decide which one would be the best for me. I jsut looked at asp.net to get an idea of each technology but I think I need a mix of MVC and WebForms, so that is why I am asking..
I want the MVC structure in the app itself and in the URLs
I want easily create a gridview with paging and sorting and easily map it to an SQL Database
I want to style everything easily via CSS
After I looked at asp.net I think MVC3 would be great for me but I need this in combination with WebForms, as I saw the DataGridView Control will be the best choice for my gridview.
Does someone give me some ideas what the best might be for me ?
After a long time using PHP and HTML/JS I hate it to doe every little step and using precreated Controls I only need to map to a database and customize via css would be a great enhancement to speed development things up!
Thanks!
In my opinion you should opt for MVC 3 approach (given most of your points mentioned) combined with jQuery DataTables. This gives you a best of both worlds - a great data visualiser and all the advantages of MVC 3.
DataTables
http://datatables.net/
DataTables ASP.NET MVC 3 Tutorial on CodeProject
http://www.codeproject.com/Articles/155422/jQuery-DataTables-and-ASP-NET-MVC-Integration-Part
Additionally if you didn't want to use the jQuery Data Tables you could look into MVC 3 Web grid which is the built in DataGridView equivalent for MVC:
http://msdn.microsoft.com/en-us/magazine/hh288075.aspx
You can use MVC, with aspx, Where you can also use the webforms features that you wished for.
I know there can be a flame war about this, people would suggest different suggestions.
Go for what you want.
All of what you need is possible easily in ASP.NET MVC.

Something like Smarty in ASP.NET?

Recently, I was working with PHP.
In PHP we have a powerful template engine like Smarty.
Do we have something like Smarty in ASP.NET ?
Quick google search :
Try one of these :)
http://csharp-source.net/open-source/template-engines
Well, you could argue that all ASP.NET webform pages are similar to templates, as they don't need to (and usually don't) have any application logic within the .aspx pages (it all goes in the codebehind). However, you might find that ASP.NET MVC is even more like what you are familiar with. ASP.NET MVC supports a number of view engines, too.
Have you tried Dotliquid?
It's old but still working great with webforms. You can even have User Controls loaded dynamically that use Dotliquid templates to present data from a database or a webapi, giving you the possibility to change the presentation layer by only editing html mixed with Liquid Language (not fully covered).
Check it out at http://dotliquidmarkup.org/try-online
Liquid Documentation at https://shopify.github.io/liquid/

Tips on resources for moveable components

I would like to create a user interface like the iGoogle or facebook profiles where the end user can customize the layout. Move components around, resize e t c
Do you have any suggestions on resources/code examples in order to create something like that?
http://www.codeproject.com/KB/ajax/MakingGoogleIG.aspx
http://jqueryui.com/demos/sortable/#portlets - i think it will be good starting point for pure AJAX solution.
If you're using ASP.NET, as you say you are, look into something like ASP.NET Web Parts or dropthings. The codeplex site for dropthings is here.
Before making any decision do checkout extjs Layout Managers from the left navigation.

Resources