要求当前行变色.
焦点在当前行

解决方案 »

  1.   

    private void Flow_dg_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
    {
    if(e.Item.ItemIndex<0) return;
    if ((e.Item.ItemType==ListItemType.Item)||(e.Item.ItemType==ListItemType.AlternatingItem)) 
                { 
                    e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='#ffffcc';this.style.color='buttontext';this.style.cursor='default';"); 
                    //e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=this.getAttribute('BKC');"); 
                    e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='';this.style.color='';"); 
                } 
    }
      

  2.   

    napsoft(乡下人) 
    你贴的代码没用]
    只是改变鼠标所在行颜色
    我要的是用上下光标键选择行!!!
      

  3.   

    可以的。我就实现了,用方向键盘来移动光标。
    用到:
    grid.rows[i].cells[j].firstChild.focus();