title: Bind LINQ data via stored procedure to Gridview
body: <p>The function in dbml is,</p>
  
  <pre><code>    [Function(Name = "dbo.sp_GetQuestions")]
      public ISingleResult&lt;vw_QuestionMaster&gt; sp_GetQuestions([Parameter(Name = "Sort", DbType = "Int")] System.Nullable&lt;int&gt; sort, [Parameter(Name = "Title", DbType = "VarChar(50)")] string title, [Parameter(Name = "Tags", DbType = "VarChar(50)")] string tags, [Parameter(Name = "RecordFrom", DbType = "Int")] System.Nullable&lt;int&gt; recordFrom, [Parameter(Name = "RecordTo", DbType = "Int")] System.Nullable&lt;int&gt; recordTo)
      {
          IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), sort, title, tags, recordFrom, recordTo);
          return ((ISingleResult&lt;vw_QuestionMaster&gt;)(result.ReturnValue));
      }
  </code></pre>
  
  <p>The function that I defined in DataAccessLayer is,</p>
  
  <pre><code>    public static ?????????????????? GetMostDiscussedQuestions()
      {
          using (AbToBolDataClassesDataContext db = new AbToBolDataClassesDataContext())
          {
              //ISingleResult&lt;vw_QuestionMaster&gt; questions = db.sp_GetQuestions(1, null, null, 1, 5);
              //return questions.ToList();
  
              var query = from qm in db.sp_GetQuestions(1, null, null, 1, 5)
                          select qm;
  
              return query;
          }
      }
  </code></pre>
  
  <p>Here in this case, i am calling the above method to set the datasource of a gridview. Although i am getting data in query by calling the stored procedure, but please aware me about what should be the correct return type for this method. and how to fetch the same from 'query'.</p>
  
  <p>I tried out with, query.ToList() but is throwing error of non-conversion of List&lt;> type to DataTable.</p>