title: Run jquery every time the grid is populated and loop through all the rows of gridview
body: <p>I want the jquery file run every time the Grid is populated and the jquery file should
   loop through the gridview and perform some action based on certain conditions.
  In my grid I have a column called StatusId in the gridview and based on Statuid I want to set the text for the label which is inside another column. I am trying to accomplish this using jQuery. I don't know where I am going wrong. </p>
  
  <p>I have an external JS file called Setstatus.js</p>
  
  <p>StatusId is a bound field in the gridview.
  lblStatus is a label in the template field of the gridview.</p>
  
  <pre><code>$(document).ready(function () {
  
      $('#&lt;%=gvAsgnments.ClientID%&gt;')
                   .find('tr')
                   .each(function (row) {
                       $(this).each(function (col) {
                           if (($.trim($(this).find("input[id*='StatusId']").val() === 0))) {
                               $("input[id*='lblStatus']", $(this)).val('New');
                               $("input[id*='StatusId']", $(this)).style.display = 'block';
                           }
                       });
                   });
  
  }); 
  </code></pre>
  
  <p>I am referring to Setstatus.js in my aspx page</p>
  
  <pre><code>&lt;script type="text/javascript" src="Scripts/Admin.js" &gt;&lt;/script&gt;
  </code></pre>
  
  <p>The jquery file does not produce any results. What am I misssing.</p>
  
  <p>sample HTMl:</p>
  
  <pre><code>   &lt;div&gt;
          &lt;table class="CNIGridView" cellspacing="0" rules="all" align="center" border="1" id="MainContent_gvAsgnments" style="border-collapse:collapse;"&gt;
              &lt;tr class="CNIGridViewHeader"&gt;
                          &lt;th scope="col" abbr="Status"&gt;&amp;nbsp;&lt;/th&gt;
                          &lt;th scope="col" abbr="Claim"&gt;Claim&lt;/th&gt;
                          &lt;th scope="col" abbr="Claimant"&gt;Claimant&lt;/th&gt;
                          &lt;th scope="col" abbr="Date"&gt;Date&lt;/th&gt;
                          &lt;th scope="col"&gt;StatusId&lt;/th&gt;
              &lt;/tr&gt;
                      &lt;tr class="CNIGridViewRow"&gt;
                    &lt;td&gt;
                             &lt;span id="MainContent_gvAdminActiveAsgnments_lblStatus_0"&gt;&lt;/span&gt;
                            &lt;/td&gt;
                            &lt;td&gt;
                             &lt;span id ="MainContent_gvAdminActiveAsgnments_lblClaim_0"&gt;MH001025&lt;/span&gt;
                            &lt;/td&gt;
                             &lt;td&gt;
                            &lt;span id="MainContent_gvAdminActiveAsgnments_lblClaimant_0"&gt;Deborah&lt;/span&gt;
                             &lt;/td&gt;
                             &lt;td&gt;10/2/2011 12:00:00 AM&lt;/td&gt;
                  &lt;td&gt;0&lt;/td&gt;
                     &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Thanks in advance</p>
  
  <p>BB</p>