For an unknown reason, I have 1 page that I can't access by ID to any of the component.
Here is some informations. The page use asp:Content because the website use MasterPage. Inside the asp:Content, this page has a asp:FormView with some data that I cannot access from the CodeBehind.
Here is the Page declaration:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="InfoAccount.aspx.cs" Inherits="Private_InfoAccount" MasterPageFile="~/MasterPagePrincipal.master" %>
Here is the code in the page behind that doesn't compile :
protected void FormView1_PreRender(object sender, EventArgs e)
{
DateBirthdayValidator.MaximumValue = DateTime.Now.Date.ToString("dd-MM-yy");
}
Here is the error :
Error 2 The name 'DateBirthdayValidator' does not exist in the current context
I have search in google, I got some answer about using FindControl but it doesn't work. Any idea?
Edit1:
I can access the FormView1 component but no the validator inside the EditItemTemplate. How can I access control that is inside the EditTemplate?
Edit2:
If I try: FormView1.FindControl("DateBirthdayValidator")
it compile but always return null. So still doesn't work but at least I can access the FormView1...