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

Any idea?
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());
if ((c!=null))
c.Visible = true;
Response.Write("Found"); // only for test

Response.Write("Not Found"); // only for test

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!