views:

23

answers:

1

i have a sentence with html. action link:

<b>Please enter your username and password.
        <%= Html.ActionLink("Register", "Register", null, new { @id = "logOnLinkRegister" })%>
        if you don't have an account. </b>

how can i save it in resource.aspx.resx file? it is in the asp.net mvc web project.

A: 

Firstly, add the value to your resource file, Visual Studio does this visually, so add

Name: Register
Value: Register

Name: IfYouDontHaveAnAccount
Value: if you don't have an account

Make sure you set up the following setting on your resource file...

Access Modifier "Public"

This will then generate the class automatically.

Now you can use the resources directly in your views... It is assumed that "YourProjectName" would be your actual project name and that you've popped a resource file called "Labels" in a folder called "Resources"

<%@ Import Namespace="YourProjectname.Resources" %>

<strong>Please enter your username and password.
<%= Html.ActionLink(Labels.Register, "Register", null, 
    new { @id = "logOnLinkRegister" })%>
Labels.IfYouDontHaveAnAccount. </strong>
Sohnee