C#

Moderators: None (Apply to moderate this forum)
Number of threads: 2722
Number of posts: 5749

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Findcontrol is not working !!! Posted by papillonx101 on 25 Jun 2012 at 6:03 AM
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
}

}
Thread Tree
papillonx101 Findcontrol is not working !!! on 25 Jun 2012 at 6:03 AM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.