NiceToMytyuk
NiceToMytyuk

Reputation: 4277

ASPX: Placeholder not declared

Actually i'm trying to add another placeholder to my code, in aspx it's look's like the following

  <asp:PlaceHolder ID="countPlace" runat="server"></asp:PlaceHolder>

While in codebehind i'm trying to do the following

  countPlace.Controls.Add(New LiteralControl(footer.ToString))

But i'm getting the error BC30451 which say that countPlace is not declared.

While i'm trying to use countPlace in codebehind i get a warning error which says "change item context"

enter image description here

Upvotes: 3

Views: 167

Answers (1)

NiceToMytyuk
NiceToMytyuk

Reputation: 4277

By adding CodeBehind solved that problem, but actually i can't understand why the other two PlaceHolder was anyway detected without it.

So i just changed from :

<%@ Page Language="vb" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

To:

<%@ Page Language="vb" AutoEventWireup="false" CodeFile="Default.aspx.vb" CodeBehind="~/Default.aspx.vb" Inherits="_Default" %>

Upvotes: 1

Related Questions