title: How to select top n rows from a datatable/dataview in ASP.NET
body: <p>How to the select top n rows from a datatable/dataview in ASP.NET? Currently I am using the following code, passing the table and number of rows to get the records. Is there a better way?</p>
  
  <pre><code>public DataTable  SelectTopDataRow(DataTable dt, int count)
  {
       DataTable dtn = dt.Clone();
       for (int i = 0; i &lt; count; i++)
       {
           dtn.ImportRow(dt.Rows[i]);
       }
  
       return dtn;
  }
  </code></pre>