Can't find control using FindControl
You are having trouble finding the control to find something, but it returns null when the control exists.
It is called on asp:button click
(and no fields are dynamically mapped to them). The controls are labels and have a server runat etc I am using Umbraco, thought the transition Page.FindControl
might not work / w umbraco because it uses master pages? Here's the code:
<asp:Label ID="Reg_Name_Error" CssClass="error" runat="server" />
if (Page.FindControl("Reg_Name_Error") != null) { }
+3
source to share
1 answer
When you are using the main page you need to write the following code
ContentPlaceHolder content;
content = (ContentPlaceHolder)Master.FindControl("Your Content Place Holder Id");
Then write the following code
if (content != null)
{
if (content.FindControl("Reg_Name_Error") != null)
+3
source to share