Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Findcontrol is not working !!!
Can someone tell me what I am doing wrong?
Initialy I set Visible property of some of the controls in my ASPX to false.
I am reading table which has the IDs of the controls in my particular ASPX page.
Then I iterate in my list and if the ID of control is the same in table and page I
will set controls property visible to true in my ASPX page for the control I find in page otherswise do nothing.
The list is well populated but I dont understand why the program is always jumping
on **else block
Thanks in advance and here is my code.
private void ShowControls()
SecurityList tempList = new SecurityList();
SecurityList sec = new SecurityList();
string AppID = "INOUT"; //This will come from the DB in future
string UserID = "joe"; //This will come from the DB in future
string PageID = "10"; //This will come from the DB in future
tempList = SecurityManager.GetList(sec,AppID,UserID,PageID);
foreach (Security loop in tempList)
Control c = FindControl(loop.ControlID.ToString());
c.Visible = true;
Response.Write("Found"); // only for test
Response.Write("Not Found"); // only for test