How to retrieve all static texts from resource in a mvc website? - asp.net-mvc

I want to build a multi language website. I found some resource about that but I don't know how I can retrieve texts from resource file and put it on a HTML tag.
for example I have a h1 tag and I want to get it's text from resource file and change this text according to selected language.
I mean I don't know about how to use localization in views.
thanks for help

As i do not have reputation to sent a comment yet. Here is a link on how this is done from Microsoft for ASP.NET Core MVC.
Globalization and localization
For ASP.NET MVC 5 you can check a helpful tutorial from CodeProject

You can read this article about ASP.NET Core MVC Localization by URL.
And also there is GitHub repo of implementation of that article. Project is built on ASP.NET Core 2.0.

Related

Adding images in resource file in asp .net mvc

I am trying to develop a basic multilingual app in Asp.Net MVC 4. I don't know how to set image files for different languages. I know it has to be added in the resource file. But I don't know how to call it on the view page. Can someone help me with this?
You should store image path in .rsex file as per your language and can use it.

Using the razor engine in SharePoint 2013 Visual Web Part

I'm trying to make use of the razor engine in a SharePoint 2013 Web Part. This, I read, shouldn't be too difficult since SharePoint 2013 Visual Web Parts can be built using .NET Framework 4.0
I'm simply not sure of where to begin to do this. I've seen an article on uploading the .cshtml file onto a document library and referencing the document library in the Web Part, but it is a bit unclear.
Does anyone have an idea of how I can start? Or point me to a step-by-step guide to achieve what I am after.
What my end goal is: Take a piece of an MVC application, customize it and make it a Web Part. I need to be able to modify or access SharePoint content on that site which is why I cannot use an App Part.
Okay.
First install the Office Development Templates from
http://www.microsoft.com/visualstudio/eng/office-dev-tools-for-visual-studio
This will give you the following template selection on reopening Studio
Then navigate to wherever EwsManagedApi32.msi is and enter the following command in an elevated prompt -
EwsManagedApi32.msi addlocal="ExchangeWebServicesApi_Feature,ExchangeWebServicesApi_Gac"
Now your templates are usable and the one you want is "VS2012 Web Part".
Now, by default this will add an ASP.NET project, which is not what you want, so manually delete the ASP.NET project, add an MVC one, highlight the SharePoint project in Solution Explorer, hit F4, and select the MVC project in the "Web Project" dropdown at the bottom of the properties.
And there you go. One controller per web part, sorted.
I am sharing link SharePoint MVC webpart that uses Knock out framework using MVC for SharePoint. It has step by step instructions which might help you.
Hope this will be a good starting point
http://www.codeproject.com/Tips/739445/SharePoint-Razor-View-WebPart

Swap English to Spanish in ValidationMessageFor Method Dynamicaly

My Models / data silos are in a different class library which contain data annotation - Required, Max Length and some custom validation. This all works great in English however is there a way to swap the English validation message for the Spanish using a global resource file contained in the web project. The class library is used both on the web site and other components so I cannot be assured that the resource file will be in the same project.
Assuming you are talking about a .Net MVC application, I suggest you have a look at this blog post about internationalization in MVC3:
http://afana.me/post/aspnet-mvc-internationalization.aspx
For a project I am currently working on, we decided to place the resource-files in a separate project, so that we could keep all the resource-strings in one place, and then simply referring to the language-project from any other project that needs multi-lingual support.

File upload control for asp.net mvc

I'm writing an asp.net mvc application. I'm looking for free control to make file(s) upload. (Multiple files upload is not required). I found uploadify, ajax uploader, c5 filemanager.
I'm looking rather example which I could include in Razor form and add additional fields such as i.e. file description.
Do you have any specific control which you could suggest?
Uploadify in my opinion is the best.
Check out:
How do I get jQuery's Uploadify plugin to work with ASP.NET MVC?
its the same in mvc3.

How to put an ASP.Net website inside MVC website?

I have an ASP.Net website and I want to put this website inside a MVC website I recently did, so this ASP.Net website will be part from the MVC website.
Is there a standard or a known way to do so?
Ask me if you want to know more information, I am not sure what info could help.
this shows merging an existing asp.net site into a new MVC3 site. The same applies for merging existing into existing. Just get a merge tool and merge them!
http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNET4WebFormsApplications.aspx
Could you put your MVC project into the webforms one? If so, this nuget will help with that: http://www.nuget.org/Tags/WebForms

Resources