2012-04-04 52 views

回答

2

添加ItemDataBound事件處理程序到DataList

ASPX:

<asp:DataList ID="DataList1" runat="server" 
     onitemdatabound="DataList1_ItemDataBound"> 
</asp:DataList> 

代碼背後:

Protected Sub DataList1_ItemDataBound(sender As Object, e As DataListItemEventArgs)    
    If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then 
     ' check condition and change styles 
    End If 
End Sub 
相關問題