title: Finding repeater control in class
body: <p>Am trying to find a repeater control in a class and i don't know where I have done mistake.</p>
  
  <p>In my ASPX page i have repeater which contains two image buttons, and at the page load am calling a method which I have defined in the class.</p>
  
  <p>this is my class page,</p>
  
  <pre><code> public class Authorization
   {
      public Authorization()
      {
      }
      public void ChangeControlStatus(ControlCollection PageControls, int Role_id)
      {
      using (EHSIMSDataContext db = new EHSIMSDataContext())
      {
          var Role_Assigned = (from auth in db.AUTHORISATIONs
                               where auth.ROLE_ID.Equals(Convert.ToInt32(Role_id)) &amp;&amp; auth.PAGE_ACCESS.Equals(1)
                               select auth);
  
          foreach (Control ctrl in PageControls)
          {
              string ControlName = (ctrl.GetType()).Name;
              switch (ControlName)
              {
                  case "ImageButton":
                      ImageButton imgbut = (ImageButton)ctrl;
                      {
                          foreach (var role in Role_Assigned)
                          {
                              if(role.ADD_ACCESS == false)
                                  if(imgbut.ID.Equals("BtnAdd"))
                                      imgbut.Enabled = false;
                          }
                      }
  
                      break;
                  case "Repeater":
                      Repeater rep = (Repeater)ctrl;
  
                      foreach (RepeaterItem item in rep.Items)
                      {
                          ImageButton img_but = item.FindControl("lnkEdit") as ImageButton;
                                if (role.EDIT_ACCESS == false)
                                  if (img_but.ID.Equals("lnkEdit"))
                                      img_but.Enabled = false;            
                      }
                      break;
  
  
              }
              ChangeControlStatus(ctrl.Controls, Role_id);
          }
  
      }
  }
  </code></pre>
  
  <p>} 
   This is what i have done in the ASPX page,</p>
  
  <pre><code>  protected void Page_Load(object sender, EventArgs e)
     {
      Authorization assign_auth = new Authorization();
      assign_auth.ChangeControlStatus(Page.Controls, Roleid);
      if (!IsPostBack)
      {
         -----
  </code></pre>
  
  <p>Now,am passing all the controls to the method "ChangeControlStatus"
  since am having image button inside a repeater the foreach in the method above doesn't work,but its finding the 'Repeater' control.
  What should i do to find the control in the method?</p>
  
  <p>Additional Message.
  So,to say simple in our project we have many users with different roles,based on the roles i want to enable/disable or the controls.
  I cant do this in each and every page of our project since there are many controls and many pages.</p>