RT效果就是 點中任意一行,會用不同的顏色高亮顯示該行.
并且該行已被選中(即能得到遠中行的index)不知道WINFROM和WEB程序會不會有什么不一樣.我這裡問的是WEB的.

解决方案 »

  1.   

     protected void girdView1_RowDataBound(object sender, GridViewRowEventArgs e)
            {
              
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#E6F5FA'");
                    e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='WhiteSmoke'");
                }
            }
      

  2.   

    再問個相關的問題2.點擊GirdView數據行中的任意一列,實現選中該列(不是該行),並高亮顯示該列,
    并且該行已被選中(即能得到遠中行的index)又怎樣實現呢?
      

  3.   


            private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
            {
                for (int i = 0; i < dataGridView1.RowCount; i++)
                {
                    dataGridView1.Rows[i].Cells[e.RowIndex].Selected = true;
                }
            }