title: Binding LinqDataSource from code-behind to Gridview
body: <p>i have a grdidview control on the .aspx page and i am trying to connect dynamically from code behind and bind the gridview but somehow it throwing me an error... what is wrong with this code? any help?</p>
  
  <pre><code>  LinqDataSource LDS_POReport = new LinqDataSource();
              LDS_POReport.ContextTypeName = "DataContextDataContext";
              LDS_POReport.Selecting += new EventHandler&lt;LinqDataSourceSelectEventArgs&gt;(LinqDataSourcePO_Selecting);
              this.gvReport.DataSource = "LDS_POReport";
              //this.gvReport.DataBind();
  </code></pre>
  
  <p>Update:</p>
  
  <p>after i update the code to</p>
  
  <pre><code> this.gvReport.DataSource = LDS_POReport;
  </code></pre>
  
  <p>it works fine but when i try to sort i get this error:</p>
  
  <p><strong>The GridView 'gvReport' fired event Sorting 
  which wasn't handled.</strong> </p>
  
  <p>i added this but no effect.</p>
  
  <pre><code> LDS_POReport.AutoPage = true;
   LDS_POReport.AutoSort = true;
  </code></pre>