Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Saturday, July 28, 2012 9:26 PM
Hi , I am new in MVC, this is simple question, please help.
I am followiing this instruction to create that mvc project.
http://afana.me/post/aspnet-mvc-internationalization-part-2.aspx
But on step of: Validation Rules Internationalization, I got this error on this subject.
as Resources is a seperate project file, so in AccoutModels.cs, I have added Resources in my name space as this
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Web.Mvc;
using System.Web.Security;
using Resources;
....
[Required(ErrorMessageResourceName = "YouMustSpecifyUsername", ErrorMessageResourceType = typeof(Resources.Resources))]
[Display(Name = "ModelUsername", ResourceType = typeof(Resources.Resources))]
public string UserName { get; set; }
.....
As I use Resources.Resources in my code, and I declare the wrong namespace, anybody know how to define the name space in this case?
in my Solution, the project structure is as this:
Solution 'NerdDinner' (2 projects)
NerdDinner this is project file
.
.
Models
AccountModels.cs
Resources - this is project file
Resources.resx
Resources.fr.resx
All replies (2)
Saturday, July 28, 2012 9:39 PM âś…Answered
Hi,
You have local resources and other project local resource. For other local resource, you need to "Add Refference" to your project. and all resources file must set "Access Modifier:" to "Public", You can open Resource FIle, and at the Open Menu above the open resource you can find menu, one of the menu is "Access Modifier:".
In Web.config at the root folder, you need to add the following code (BOLD):
<system.web>
<globalization culture="auto" uiCulture="auto" />
Namespace "Resource" is just a name, it can be any name.
Hope can help
Saturday, July 28, 2012 9:45 PM
Hi,
You have local resources and other project local resource. For other local resource, you need to "Add Refference" to your project. and all resources file must set "Access Modifier:" to "Public", You can open Resource FIle, and at the Open Menu above the open resource you can find menu, one of the menu is "Access Modifier:".
In Web.config at the root folder, you need to add the following code (BOLD):
<system.web>
<globalization culture="auto" uiCulture="auto" />
Namespace "Resource" is just a name, it can be any name.
Hope can help
Thank you so much, yes, Add references solves me problem, really appreciative.