Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's 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 its 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 !!!

papillonx101papillonx101 Posts: 1Member
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

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

}
Sign In or Register to comment.