views:

73

answers:

1

Hi,

I would like to get validation messages for validation controls from resource files. I know I can do that easily by following code snippet.

<%$ Resources:[filename prefix,]resource-key %>

or

<asp:Label ID="Label1" runat="server" meta:resourcekey="resource-key-prefix" />

But I would also like to parameterized it.

e.g. Above Resource Expression will give me message like "Fill Information.". What I have in resource file is "Fill {0} Information." which should show end user message like "Fill Address Information.".

A: 

So basically you want to have a localized Formatstring.

You can access the resource file from the codebehind, perform a String.Format and pass the value on to a control.

E.g.

myLabel.Text = string.Format(ProjectnameSpace.Resources.xxy, VALUE);

Try intellisense to get the full path of the property, I don't have visual studio here atm

citronas