title: Enabled or disabled checkbox in gridview using datatable in C# and ASP.NET
body: <p>In my mysql table the users enabled are divided by <code>level</code> and <code>perimeter</code></p>
  <pre><code>+---------+--------+------------+
  | uname   | ulevel | uperimeter |
  +---------+--------+------------+
  | 5207459 |      1 | 400X       |
  | 5204759 |      1 | 4SXR       |
  +---------+--------+------------+
  </code></pre>
  <p>I need to enable a <code>checkbox</code> in the <code>gridview</code> for each user, when your level is <code>1</code> value and for your enabling <code>perimeter</code>.</p>
  <p>This is my code-behind in ASP.NET written in C#. But for the <code>uname 5207459</code> in <code>gridview</code> is enabled only the checkbox with <code>uperimeter 4SXR</code>, instead of <code>uperimeter 400X</code> and <code>uperimeter 4SXR</code>.</p>
  <p>Help me to do it.</p>
  <pre><code>while (reader.Read())
  {
      ulevel = reader.GetString(0);
      uperimeter = reader.GetString(1);
  
      DataTable dt = new DataTable();
      dt.Columns.Add(&quot;p_ulevel&quot;, typeof(string));
      dt.Columns.Add(&quot;p_uperimeter&quot;, typeof(string));
  
      dt.Rows.Add(new object[] { ulevel, uperimeter });
  
      var tulevel2 = dt.AsEnumerable().Select(z =&gt; z.Field&lt;string&gt;(&quot;p_ulevel&quot;)).FirstOrDefault(s =&gt; s.Contains(ulevel));
      var tuperimeter2 = dt.AsEnumerable().Select(z =&gt; z.Field&lt;string&gt;(&quot;p_uperimeter&quot;)).FirstOrDefault(s =&gt; s.Contains(uperimeter));
  
      if (Convert.ToInt32(tulevel2) == 1 &amp;&amp; tuperimeter2.ToString().Contains(tuperimeter.ToString()))
      {                                
          chkRow.Enabled = true;
      }
      else
      {
          chkRow.Enabled = false;
      }
  }
  </code></pre>
  <p><strong>Update</strong></p>
  <p>If change operator <code>&amp;&amp;</code></p>
  <pre><code>if (Convert.ToInt32(tulevel2) == 1 &amp;&amp; tuperimeter2.ToString().Contains(tuperimeter.ToString()))
  </code></pre>
  <p>to operator <code>||</code></p>
  <pre><code>if (Convert.ToInt32(tulevel2) == 1 || tuperimeter2.ToString().Contains(tuperimeter.ToString()))
  </code></pre>
  <p>For the <code>uname 5207459</code> in <code>gridview</code> is enabled all checkbox with <code>uperimeter 400X</code> and <code>uperimeter 4SXR</code>.</p>
  <p>I don't understand...</p>