0

I can't figure out how to add a meta:resourcekey tag to an asp:DynamicControl control. Can someone help me? Here's a working example for a basic label:

<asp:Label ID="Label1" runat="server" Text="Owner" meta:resourcekey="Label1Resource1"></asp:Label>

But what about this (it's going to generate the label and the textbox attached to the property:

  <asp:DynamicControl Mode="Edit" DataField="Target" meta:resourcekey="Target" runat="server" />

The label will never be translated to another language according the the resourcekey "Target".

Thank you.

1 Answer 1

0

For those who are in the same situation as me, I have managed to find a way to work around my problem using resource files. You need to create localized resource files and use them in your object classes as attributes like this:

 [Display(ResourceType = typeof(namespaceofyourressource), Name = "resourcekey")]
 [Required(ErrorMessageResourceType = typeof(namespaceofyourressource), ErrorMessageResourceName = "resourcekey")]
 [StringLength(150)]
 public string NameEn { get; set; }

The dynamics controls will be generated correctly.

1
  • Please upvote if this is helpful for you. Thank you. Commented Sep 16, 2020 at 18:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.