图标可用字体实现            <font style='font-family:webdings'>5</font>
<font style='font-family:webdings'>6</font>

解决方案 »

  1.   

    在ItemDataBind里判断Sort值设置一下~~
      

  2.   

    我用
    <font style='font-family:webdings'>5</font>
    <font style='font-family:webdings'>6</font>
      

  3.   

    <script language="javascript">
        
        
        
         var TableName = "GridView1";

    var ParentObj = null;
    function ClickThis(e)//排序
    {
    if(ParentObj != null)
    {
    ParentObj.style.backgroundColor = "#FFFFFF";
    }
    e.style.backgroundColor = "#DEF8FF";
    ParentObj = e;
    e.style.backgroundColor = "#DEF8FF";
    }

    function window.onload()
    {
    var Obj = eval("document.all."+ TableName +".rows;");
    for(var i=1; i<Obj.length; i++)
    {
    Obj[i].onclick = new Function("ClickThis(this)");
    }

    var ObjHead = eval("document.all."+ TableName +".rows[0].cells");
    for(var i=0; i<ObjHead.length; i++)
    {
    ObjHead[i].innerHTML = "<span style=\"cursor:hand;width:100%\" onclick=\"Order(this)\">"+ ObjHead[i].innerHTML +"</span>";
    }
    }

    var ParentNode = null;
    function Order(e)
    {
    if(ParentNode != null && ParentNode != e)
    {
    ParentNode.innerText = ParentNode.innerText.replace(UP(),'').replace(Down(),'');
    }
    if(ParentNode != e)
    {
    e.innerText = e.innerText.replace(UP(),'').replace(Down(),'') + UP();
    OrderThis(e,"D");
    }
    else
    {
    if(e.innerText.replace(UP(),'') != e.innerText)
    {
    e.innerText = e.innerText.replace(UP(),'').replace(Down(),'') + Down();
    OrderThis(e,"U");
    }
    else
    {
    e.innerText = e.innerText.replace(UP(),'').replace(Down(),'') + UP();
    OrderThis(e,"D");
    }
    }
    ParentNode = e;
    }

    function UP()
    {
    return "▼";
    }

    function Down()
    {
    return "▲";
    }

    function OrderThis(e, Order)
    {
    var Rows;
    var ObjHead = eval("document.all."+ TableName +".rows[0].cells");
    for(var i=0; i<ObjHead.length; i++)
    {
    if(ObjHead[i].childNodes[0] == e)
    {
    Rows = i;
    break;
    }
    }

    //alert(Rows);
    //alert(Order);

    var Obj = eval("document.all."+ TableName);
    var d = new Date();
    ShordOrder(Obj, Rows, Order);
    //alert("时间:"+ (new Date()-d) +"    行数:"+ Obj.rows.length);
    }



    //
    // objTB 表名  index所选择的列  Order选择的排序方式(D,U)
    // 关键方法 排序
    //
    function ShordOrder(objTB,index, Order){
    var i;
    var j;
    for(i=1;i<(objTB.rows.length-1);i++){
    for(j=i+1;j<objTB.rows.length;j++)
    {
    if(Order == "D")
    {
    if(objTB.rows[j].cells[index].innerText.valueOf() > objTB.rows[i].cells[index].innerText.valueOf())
    {
    objTB.moveRow(j,i);
    }
    }
    else
    {
    if(objTB.rows[j].cells[index].innerText.valueOf() < objTB.rows[i].cells[index].innerText.valueOf())
    {
    objTB.moveRow(j,i);
    }
    }
    }
    }
    }

    //判断鼠标是否按下
    var mouseDown = false;
    //鼠标所在区域
    var IsTdArea=0;//鼠标按下
    function MouseDown(obj)
    {
    if(IsTdArea != 0)
    {
       obj.mouseDownY = event.clientY;
       obj.mouseDownX=event.clientX;
       obj.parentTdH = obj.offsetHeight;
       obj.pareneTdW=obj.offsetWidth;
       //获得table的高度
       obj.pareneTableH=obj.parentElement.parentElement.parentElement.offsetHeight;
       //获得table的宽度
       obj.pareneTableW=obj.parentElement.parentElement.parentElement.offsetWidth;
       obj.setCapture();
       mouseDown = true;
    }
    else
    {
    mouseDown = false;
    }
    }function MouseMove(obj)
    {
    if(mouseDown == true)
    {
    if(IsTdArea == 1 || IsTdArea == 2)
    {
       if(!obj.mouseDownX) return false;
       var newWidth=obj.pareneTdW*1+event.clientX*1-obj.mouseDownX;
       if(newWidth>0)
       {
          obj.style.width = newWidth;
        obj.parentElement.parentElement.parentElement.style.width=obj.pareneTableW*1+event.clientX*1-obj.mouseDownX;
      }
    }
    else if(IsTdArea ==3 || IsTdArea == 4)
    {
       if(!obj.mouseDownY) return false;
       var newHeight=obj.pareneTdH*1+event.clientY*1-obj.mouseDownY;
       if(newHeight>0)
        {
          obj.style.Height = newHeight;
      obj.parentElement.parentElement.parentElement.style.Height=obj.pareneTableH*1+event.clientY*1-obj.mouseDownY;
          }
        }
       }
      else
       {
        MouseOverTD(obj);
       }
    }function MouseUp(obj)
    {
      if(mouseDown == true)
       {
         obj.releaseCapture();
         obj.mouseDownY = 0;
         obj.mouseDownX=0;
         mouseDown = false;
         IsTdArea=0;
    }
      else
      {
         mouseDown = false;
         IsTdArea=0;
       }
    }function MouseOverTD(objchild)
    {
    var objTD = objchild;
    if(mouseDown == false)
    {
       //获得TD所属的Table
       var tbab = objTD.parentElement.parentElement.parentElement;
       //获得Table的左边坐标值
       var tbOffSetLeft =tbab.offsetLeft;if(objTD.offsetLeft <=(event.x+1) && objTD.offsetLeft >= (event.x-1))
    {
       //调整左边
       IsTdArea = 1;
       objTD.style.cursor ="w-resize";
       window.document.getElementById("Table1").style.cursor = "w-resize"; 
    }
    else if((objTD.offsetLeft+objTD.offsetWidth) <= (event.x+1) && (objTD.offsetLeft+objTD.offsetWidth) >= (event.x-1))
    {
      //调整右边
      IsTdArea = 2;
      objTD.style.cursor ="w-resize";

    else if(objTD.offsetTop <= (event.y+1) && objTD.offsetTop >= (event.y-1))
    {
       //调整上边
       IsTdArea = 3;
       objTD.style.cursor ="s-resize";
    }
    else if((objTD.offsetTop+objTD.offsetHeight) <= (event.y+1) && (objTD.offsetTop+objTD.offsetHeight) >= (event.y-1))
    {
        //调整下边
        IsTdArea = 4;
       objTD.style.cursor ="s-resize";
       }
       else
      {
        IsTdArea = 0;
        objTD.style.cursor = "auto";
         }
      } 
    }</script>
      

  4.   

    翻译的实例代码,看似完全符合:)http://bbs.msproject.cn/default.aspx?g=posts&t=296