在webform中的datagrid中如何实现每行选中有小手的效果?还可以双击触发一个事件 在webform中的datagrid中如何实现每行选中有小手的效果?还可以双击触发一个事件向下面的效果http://www.tjc.gov.cn/workrefer/ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 自己在itemdatabind时写代码就可以了。 private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { //当鼠标移到本行是颜色发生变化 if(e.Item.ItemIndex>=0) { e.Item.Cells[2].Attributes["onmouseover"] ="javascript:this.bgColor='#FF00F0';"; e.Item.Cells[2].Attributes["onmouseout"] ="javascript:this.bgColor='#FFFFFF';"; } 要小手的话加上style="cursor:hand;"如果要加事件的话有两种方法:1种在itemcommand里写。 另一种是加上onclick="window.open('View.aspx?id=5374','','toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');return false这种} 另外http://www.tjc.gov.cn/workrefer/这个网页的做得也不怎么样。 private void ListDataGrid_ItemCreated(object sender,System.Web.UI.WebControls.DataGridItemEventArgs e){ if ( ( e.Item.ItemType == ListItemType.Item ) ¦ ¦ ( e.Item.ItemType ==ListItemType.AlternatingItem ) ¦ ¦ ( e.Item.ItemType ==ListItemType.SelectedItem ) ) { e.Item.Attributes.Add( "OnMouseOver", "this.style.backgroundColor ='#BED3E9';this.style.cursor='hand'"); e.Item.Attributes.Add( "OnMouseOut","this.style.backgroundColor='white';"); e.Item.Attributes.Add("onclick","location.href='Modify.aspx?portalId"+"="+ListDataGrid.DataKeys[e.Item.ItemIndex].ToString() +"'"); }}你不要用e.Item.Cells[2](他对应td)用e.Item.Attributes.Add(它对应所有td,就是tr) VS2005打包安装数据库问题? [Help]请教通过WndProc接收消息的问题... TreeView AfterLabelEdit 事件 (非常急) 紧急求救!用.net2005开发asp.net中DataGrid控件遇到的棘手问题! 遍历成员 VS2005环境中的label控件问题? InstanceDescriptor 找代码:asp.net电子商务高级编程 像这样有下拉的工具是怎么做出来的? 遇到一个连接access的问题,提示非常奇怪阿,哪位大哥能帮忙解决一下? 急救!关于在webform 中的datagrid的修改. .Net的一个类型转换问题(跟反射有关),重分求解!
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
//当鼠标移到本行是颜色发生变化
if(e.Item.ItemIndex>=0)
{
e.Item.Cells[2].Attributes["onmouseover"] ="javascript:this.bgColor='#FF00F0';";
e.Item.Cells[2].Attributes["onmouseout"] ="javascript:this.bgColor='#FFFFFF';";
} 要小手的话加上style="cursor:hand;"
如果要加事件的话有两种方法:1种在itemcommand里写。 另一种是加上onclick="window.open('View.aspx?id=5374','','toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');return false
这种
}
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if ( ( e.Item.ItemType == ListItemType.Item ) ¦ ¦ ( e.Item.ItemType ==
ListItemType.AlternatingItem ) ¦ ¦ ( e.Item.ItemType ==
ListItemType.SelectedItem ) )
{
e.Item.Attributes.Add( "OnMouseOver", "this.style.backgroundColor =
'#BED3E9';this.style.cursor='hand'");
e.Item.Attributes.Add( "OnMouseOut",
"this.style.backgroundColor='white';");
e.Item.Attributes.Add("onclick",
"location.href='Modify.aspx?portalId"+"="+
ListDataGrid.DataKeys[e.Item.ItemIndex].ToString() +"'");
}
}你不要用e.Item.Cells[2](他对应td)
用e.Item.Attributes.Add(它对应所有td,就是tr)