Private Sub myDataGrid_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles myDataGrid.ItemDataBound e.Item.Attributes.Add("onmouseover", "this.setAttribute('BKC',this.style.backgroundColor); this.style.cursor='hand';this.style.backgroundColor='#dddddd'") e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=this.getAttribute('BKC');") end sub
foreach(DataGridItem item in grd1.Items )
{
for(int i=1;i<grd1.Columns.Count;i++)
{
item.Cells[i].Attributes.Add("Style","cursor:hand;");
}
item.Cells[1].Attributes.Add("onclick","window.returnValue='"+item.Cells[1].Text+"';"+"self.close();");
item.Attributes.Add("onmouseover","currentcolor=this.style.backgroundColor;this.style.backgroundColor='#b7c4e2'");
item.Attributes.Add("onmouseout","this.style.backgroundColor=currentcolor");
}
}
function document.onclick()
{
var ObjTable = document.all.DataGrid1;
if(ObjTable.contains(event.srcElement) == true)
{
if(ParentObj != null)
{
ParentObj.style.color = '000000';
}
var ThisObj = event.srcElement.parentNode;
while(ThisObj.tagName != "TR") ThisObj = ThisObj.parentNode;
ThisObj.style.color = 'FF0000';
ParentObj = ThisObj;
}
}
e.Item.Attributes.Add("onmouseover", "this.setAttribute('BKC',this.style.backgroundColor); this.style.cursor='hand';this.style.backgroundColor='#dddddd'")
e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor=this.getAttribute('BKC');")
end sub
http://dotnet.aspx.cc/Exam/DragableXpStyleTable/DragableXpStyleTable.aspx我看了这个xp效果的了,有知道如何能让这个datagrid显示表格线么?