Search code examples
asp.netmeta-attribute

Meta Attribute in Asp.NET


I was wondering what the logic is behind meta attribute. For example in asp.net for localization we can use something like this to localize a control :

<asp:Button ID="Button1" runat="server" Text="DefaultText" 
meta:resourcekey="Button1" />

So what's the logic of meta:resourcekey="Button1".Is there any different usage of meta tags like in this example ?

Thanks.


Solution

  • For hiding your asp.net tag attribute from HTML output

    You have an attribute and you want to hide this attribute in your HTML output . It useful when you dont want extra junk in your response then use “meta:”

    Example:

    <asp:Label id="myLabel" runat="server"  text=”hello”  myattribute="mello"  />
    

    Output is

    <span myattribute="mello">hello </span>
    

    with using meta:

    <asp:Label id="myLabel" runat="server"  text="hello"  meta:myattribute="mello"  />
    

    output is

    <span>hello</span>
    

    Source