我有List<Something>
類型的屬性的用戶控件:ASP.NET:自定義控件(或用戶控件),屬性爲List <Something>。該屬性可以在ASPX源代碼中設置嗎?
Private p_myList As New List(Of Guid)
Public Property MyList() As List(Of Guid)
Get
Return p_myList
End Get
Set(ByVal value As List(Of Guid))
If value Is Nothing Then Throw New ArgumentNullException()
p_myList = value
End Set
End Property
是否popssible在使用用戶控件的頁面的ASPX源設置此屬性,例如,像:
<uc1:myUserControl runat="server" MyList="3c7d794e-7645-46e7-bdde-a0bc42679261, 3c7d794e-7645-46e7-bdde-a0bc42679262" />
還是我需要創建一個「兼容屬性」類型的字符串,然後解析? (我知道我可以通過代碼隱藏設置這些值,但我寧願做在ASPX源。)
http://stackoverflow.com/questions/859625/is-it-possible的可能的複製-to-initialize-a-controls-listt-property-in-markup? – jelbourn 2010-10-20 14:03:12