chobo
chobo

Reputation: 32281

How to reference literalControl in masterpage?

I have a literal control in a masterpage that I would like to find from the child page and populate, but it always comes back null

[MasterPage]
  <asp:Literal ID="litStreamHtml" runat="server" />



[Child Page]
    LiteralControl litStreamHtml = Master.FindControl("litStreamHtml") as LiteralControl;
    litStreamHtml.Text = "some text";

Upvotes: 1

Views: 3330

Answers (1)

chobo
chobo

Reputation: 32281

Ugh... The problem was I was using LiteralControl, instead of Literal. I didn't know there was a difference.

Literal litStreamHtml = (Literal)this.Master.FindControl("litStreamHtml");
    litStreamHtml.Text = "some text";

Upvotes: 3

Related Questions