GridView滑鼠經過感知以及點選行彈出視窗

weixin_30924079發表於2020-04-04

private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{  
      if(e.Item.ItemIndex>=0) //此行可以刪除掉
      {
                //彈出視窗程式碼
e.Item.Attributes.Add("onclick","window.open('WebForm2.aspx?ZoneNo="+e.Item.Cells[0].Text+"','','Toolbar=no')");
e.Item.Attributes.Add("onMouseOver","this.style.backgroundColor='#e9e9e9'; this.style.cursor='hand';");
e.Item.Attributes.Add("onMouseOut","this.style.backgroundColor='#f7f7f7';");  
      }
}

轉載於:https://www.cnblogs.com/jcomet/archive/2008/07/15/1243280.html

相關文章