title: c# code to set an attribute of a class of a group of controls
body: <p>i have researched but none of the direct method was found to do this task.what i am trying to do is,i have some asp:textboxes which have same class</p>
  
  <pre><code>&lt;asp:TextBox ID="txtItemAmnt5"  class="totaltextbox" runat="server" Width="106px"&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>and with the help of c# code i want to hide all the textboxes which belongs to the same class.one of the indirect approach is this, which is irritating. does any one have smarter code</p>
  
  <pre><code> for (int j =1 ; j &lt;=9 ; j++)
          {
  
              TextBox objtxt = this.Master.FindControl("ContentPlaceHolder1").FindControl("txt"+j.ToString()) as TextBox;
  
              objtxt.Visible= true;
              }
  </code></pre>