Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) If e.Item.ItemType = ListItemType.Item Or _ e.Item.ItemType = ListItemType.AlternatingItem Then e.Item.Cells(1).Attributes.Add("onmouseover", "this.style.backgroundColor='#DDEEFF'") e.Item.Cells(1).Attributes.Add("onmouseout", "this.style.backgroundColor='white'") e.Item.Cells(3).Attributes.Add("onclick", "alert('You click at ID: " & e.Item.Cells(0).Text & "!');") End If End SubTreeView: <iewc:treeview id="tvAreaStation" ondbclick="tvdbclick();" runat="server"></iewc:treeview>OR sub TreeView1_onclick() 'do something end sub
If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Then
e.Item.Cells(1).Attributes.Add("onmouseover", "this.style.backgroundColor='#DDEEFF'")
e.Item.Cells(1).Attributes.Add("onmouseout", "this.style.backgroundColor='white'")
e.Item.Cells(3).Attributes.Add("onclick", "alert('You click at ID: " & e.Item.Cells(0).Text & "!');")
End If
End SubTreeView:
<iewc:treeview id="tvAreaStation" ondbclick="tvdbclick();" runat="server"></iewc:treeview>OR sub TreeView1_onclick()
'do something
end sub
<iewc:treeview id="tvAreaStation" ondbclick="tvdbclick();" runat="server"></iewc:treeview>
中ondbclick="tvdbclick();" 表示在.aspx中注册一个双击事件响应,你可以在.aspx.cs文件中写一个方法
在服务端进行处理。(注意声明为public或protected)