SQL Server database version
& Lt; % @ Page Language = & quot; C # & quot; AutoEventWireup = & quot; true & quot; % & gt; & lt; script runat = & quot; server & quot; & gt; public int TrapezoidIndex = 1; int LastNumer = 0; protected void Page_Load (object sender, EventArgs e) {string ConnectionString = & quot; persist Security Info = False; User ID = sa; Password =; Initial Catalog = Book; Server = .; & quot; System. data. sqlClient. sqlConnection cn = new System. data. sqlClient. S QlConnection (ConnectionString); cn. open (); string SQL = & quot; select *, (Yuwen + Shuxue + Yingyu) As TotalScore from [Score] Order BY TotalScore DESC & quot; System. data. sqlClient. sqlCommand cmd = new System. data. sqlClient. sqlCommand (SQL, cn); System. data. sqlClient. sqlDataReader dr = cmd. executeReader (System. data. commandBehavior. closeConnection); GridView1.DataSource = dr; GridView1.DataBind (); dr. close (); Cmd. dispose (); cn. dispose ();} protected void GridView1_RowCreated (object sender, GridViewRowEventArgs e) {if (e. row. rowType = DataControlRowType. dataRow) {System. data. common. dbDataRecord db = (System. data. common. dbDataRecord) e. row. dataItem; int TotalScore = Int32.Parse (db [& quot; TotalScore & quot;]. toString (); if (e. row. rowIndex = 0) {LastNumer = TotalScore;} if (LastNumer! = TotalScore) {TrapezoidIndex = e. Row. RowIndex + 1 ;}lastnumer = TotalScore ;}& lt;/script & gt; & lt; html xmlns = & quot; http://www.w3.org/1999/xhtml"><pead Id = & quot; Head1 & quot; runat = & quot; server & quot; & gt; & lt; title & gt; examples of simultaneous ranking of GridView & lt; /title & gt; & lt;/head & gt; & lt; body & gt; & lt; form id = & quot; form1 & quot; runat = & quot; server & quot; & gt; & lt; asp: GridView ID = & quot; GridView1 & quot; runat = & quot; server & quot; AutoGenerateColumns = & quot; false & quot; onRowCreated = & quot; GridView1_RowCreated & quot; Width = & quot; 600px & quot; & gt; & lt; Columns & gt; & lt; asp: TemplateField HeaderText = & quot; data No. & quot; & gt; & lt; ItemTemplate & gt; & lt; % # Container. dataItemIndex + 1% & gt; & lt;/ItemTemplate & gt; & lt;/asp: TemplateField & gt; & lt; asp: TemplateField HeaderText = & quot; Student name & quot; & gt; & lt; ItemTemplate & gt; & lt; % # Eval (& quot; UserName & quot;) % & gt; & lt;/ItemTemplate & gt; & lt; /asp: TemplateField & gt; & lt; asp: TemplateField HeaderText = & quot; & quot; & gt; & lt; ItemTemplate & gt; & lt; % # Eval (& quot; Yuwen & quot;) % & gt; & lt;/ItemTemplate & gt; & lt;/asp: TemplateField & gt; & lt; asp: templateField HeaderText = & quot; mathematics & quot; & gt; & lt; ItemTemplate & gt; & lt ;%# Eval (& quot; Shuxue & quot;) % & gt; & lt;/ItemTemplate & gt; & lt;/asp: TemplateField & gt; & lt; asp: TemplateField HeaderText = & quot; English & quot; & gt; & lt; itemTemplate & gt; & lt; % # Eval (& quot; Yingyu & quot;) % & gt; & lt;/ItemTemplate & gt; & lt;/asp: templateField & gt; & lt; asp: TemplateField HeaderText = & quot; total score & quot; & gt; & lt; ItemStyle Font-Bold = & quot; true & quot; foreColor = & quot; red & quot;/& gt; & lt; ItemTemplate & gt; & lt; % # Eval (& quot; TotalScore & quot;) % & gt; & lt;/ItemTemplate & gt; & lt;/asp: TemplateField & gt; & lt; asp: TemplateField HeaderText = & quot; ranking & quot; & gt; & lt; itemTemplate & gt; & lt; % # TrapezoidIndex % & gt; & lt;/ItemTemplate & gt; & lt;/asp: TemplateField & gt; & lt;/Columns & gt; & lt;/asp: GridView & gt; & lt;/form & gt; & lt;/body & gt; & lt;/html & gt;