ASP.NET中DataGrid鼠标经过感知以及点击行弹出窗口

王朝c#·作者佚名  2006-12-17
窄屏简体版  字體: |||超大  

很多人说很难,其实就这几行代码。只要在DataGrid1的ItemDataBound中写入下代码即可

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';");

}

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航