Reputation: 1116
I do not manage to access a div element from code behind in ASP.NET:
Inside my aspx file:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ContactForm.aspx.cs" Inherits="Form_Mailer_ContactForm" %>
...
<div runat="server" id="SentFormDiv">
<s>my content</s>
</div>
Inside the corresponding .cs file (ContactForm.aspx):
protected void Page_Load(object sender, EventArgs e)
{
this.SentFormDiv.Visible=false;
}
I get the usual compilation error message:
does not contain a definition for 'SentFormDiv' and no extension method 'SentFormDiv' accepting a first argument of type 'xxx.SentFormDiv' could be found (are you missing a using directive or an assembly reference?)
The odd part is that is I start typing SentFor
into the code behind, the Intellisense does suggest me SentFormDiv
!!
What did I miss?
Upvotes: 0
Views: 2435