Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Edited the answer according to the comments.<br> I would define a class to incorporate the results of your query first:</p> <pre><code>public class OrderDataResults // Or whatever you want to call it { public int DriverId { get; set; } public int OrderCount { get; set; } public int OrderCountWhereNameIsNotNull { get; set; } } </code></pre> <p>From your server you can return a list of those:</p> <pre><code>public class OrderViewRepository : BaseRepository&lt;OrderView&gt; { public List&lt;OrderDataResults&gt; GetOrderDataResults() { return GetQuery(). Where(x =&gt; x.SHIPMENT != null). GroupBy(o =&gt; o.DRIVER_ID). Select(g =&gt; new OrderDataResults { DriverId = g.Key, OrderCount = g.Count(), OrderCountWhereNameIsNotNull = g.Count(o =&gt; o.RECEIVE_NAME != null) }).ToList(); } } </code></pre> <p>And when loading the page you can call the <code>GetOrderDataResults()</code> method and get your list:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { var rep = new OrderViewRepository(); List&lt;OrderDataResults&gt; results = rep.GetOrderDataResults(); DataViewer.DataSource = results; DataViewer.DataBind(); } </code></pre> <p>In order to see the results, just remove the <code>&lt;Columns&gt;</code> section from your <code>GridView</code> definition:</p> <pre><code>&lt;asp:GridView runat="server" ID="DataViewer"&gt; &lt;/asp:GridView&gt; </code></pre> <p>And again, you will probably want to refactor this code and make some structural decisions on your own as soon as you get this code working (e.g. decide whether you want to return a list from your reporitory, etc).<br> Furthermore, you will probably want to customize the way your table looks, so you might want to look at the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx" rel="nofollow">GridView</a> documentation. In your case it seems that you only want to display the data, so a simpler control (such as the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.aspx" rel="nofollow">Repeater</a>) might prove to be a better fit.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload