using System;<br /> using System.Collections.Generic;<br /> using System.Linq;<br /> using System.Web;<br /> using System.Web.UI;<br /> using System.Web.UI.WebControls;<br /> <br /> public partial class Results_Standings : System.Web.UI.Page<br /> {<br /> protected void Page_Load(object sender, EventArgs e)<br /> {<br /> DataClasses2DataContext db = new DataClasses2DataContext();<br /> <br /> var Standings = from p in db.Pit_Outputs<br /> where p.Season == "2011"<br /> group p by p.Team_ID into g<br /> orderby g.Sum(w => w.W) descending<br /> <br /> select new <br /> {<br /> Team = g.First().Teams.Team_City,<br /> W = g.Sum(w => w.W),<br /> L = g.Sum(l=> l.L),<br /> P = g.Sum(w => w.W) / (g.Sum(w => w.W) + g.Sum(l => l.L)),<br /> };<br /> GridView1.DataSource = Standings;<br /> <br /> GridView1.DataBind();<br /> }<br /> protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)<br /> {<br /> <br /> }<br /> protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)<br /> {<br /> <br /> }<br /> }<br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" CellPadding="4" EnableSortingAndPagingCallbacks="True" ForeColor="#333333" GridLines="None" PageSize="30" HorizontalAlign="Center" style="text-align: right" onselectedindexchanged="GridView1_SelectedIndexChanged1"> <AlternatingRowStyle BackColor="White" /> <EditRowStyle BackColor="#2461BF" /> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <RowStyle BackColor="#EFF3FB" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <SortedAscendingCellStyle BackColor="#F5F7FB" /> <SortedAscendingHeaderStyle BackColor="#6D95E1" /> <SortedDescendingCellStyle BackColor="#E9EBEF" /> <SortedDescendingHeaderStyle BackColor="#4870BE" /> </asp:GridView>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)