Hello,
I'm trying to insert the metatags dynamically.
The following vb code works fine:
aspx.vb code:
Protected myTag As System.Web.UI.HtmlControls.HtmlGenericControl
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
myTag.Attributes("content") = "test"
End Sub
In aspx file head:
<meta id="myTag" runat="server" />
The above code is working great. But the same thing I'm trying to put in C# which is not working.
aspx.cs code:
protected System.Web.UI.HtmlControls.HtmlGenericControl myTag;
private void Page_Load(object sender, System.EventArgs e)
{
myTag.Attributes["content"] = "test";
// Also tried this--- myTag.Attributes("content") = "test";
}
In aspx file head:
<meta id="myTag" runat="server" />
Am I missing any thing? Thank you.