I have a website. from each page of website I want to call a function which will receive a parameter of type Page. Each page will pass reference of itself to that function.
That function will hide and show some control on that page based on some logic.
Now I am not sure how to pass the page parameter. If I pass "this", I am unable to find any controls which I want to hide or show. This is my function
public static void Implement(string pageName, Page objPage)
{
if (pageName == "MANAGEMENT")
{
HyperLink obj = (HyperLink) objPage.FindControl("hlSave");
if (obj != null)
{
obj.Visible = false;
}
}
}
but objPage.FindControl("hlSave"); always returns null
Any idea whats wrong here?
FindControlRecursivemethod that I have provided has to find it(with poor performance). Did you checked it?