PersistChildrenAttribute.UsesCustomPersistence プロパティ
アセンブリ: System.Web (system.web.dll 内)
構文Dim instance As PersistChildrenAttribute Dim value As Boolean value = instance.UsesCustomPersistence
入れ子になった内容をカスタマイズされた方法で保持する場合は true。それ以外の場合は false。既定値は false です。
解説入れ子になった内容をカスタマイズされた方法で保持するように設定するには、usesCustomPersistence パラメータを受け取る PersistChildrenAttribute オーバーロードを使用します。
使用例UsesCustomPersistence プロパティの値を取得する方法を次のコード例に示します。
このコード例は、PersistChildrenAttribute クラスのトピックで取り上げているコード例の一部分です。
<%@ Page Language="VB" %> <%@ Register TagPrefix="AspSample" Assembly="Samples.AspNet.VB.Controls" Namespace="PersistChildrenSampleVB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) ' Create two new employees and add them to the custom control. Dim e1 As New Employee("Employee 1", "Title 1", "Alias 1") Dim e2 As New Employee("Employee 2", "Title 2", "Alias 2") CollectionPropertyControl1.Employees.Add(e1) CollectionPropertyControl1.Employees.Add(e2) ' Verify attribute values. Dim p As PersistChildrenAttribute = _ Attribute.GetCustomAttribute(GetType(CollectionPropertyControl), _ GetType(PersistChildrenAttribute)) Dim sb As New StringBuilder() sb.Append("The Persist property is " & p.Persist.ToString() & "<br>") sb.Append("The UseCustomPersistence property is " & p.UsesCustomPersistence.ToString() & "<br>") sb.Append("The IsDefault method returns " & p.IsDefaultAttribute().ToString()) Message.Text = sb.ToString() End Sub </script> <html > <head id="Head1" runat="server"> <title>PersistChildrenAttribute</title> </head> <body> <form id="Form1" runat="server"> <div> <asp:Label ID="Message" runat="server"/> <AspSample:CollectionPropertyControl id="CollectionPropertyControl1" runat="server"> </AspSample:CollectionPropertyControl> </div> </form> </body> </html>
<%@ Page Language="C#" %> <%@ Register TagPrefix="AspSample" Assembly="Samples.AspNet.CS.Controls" Namespace="PersistChildrenSamples" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Page_Load(object sender, EventArgs e) { // Create two new employees and add them to the custom control. Employee e1 = new Employee("Employee 1", "Title 1", "Alias 1"); Employee e2 = new Employee("Employee 2", "Title 2", "Alias 2"); CollectionPropertyControl1.Employees.Add(e1); CollectionPropertyControl1.Employees.Add(e2); // Verify attribute values. PersistChildrenAttribute p = (PersistChildrenAttribute)Attribute.GetCustomAttribute(typeof(CollectionPropertyControl), typeof(PersistChildrenAttribute)); StringBuilder sb = new StringBuilder(); sb.Append("The Persist property is " + p.Persist.ToString() + "<br>"); sb.Append("The UseCustomPersistence property is " + p.UsesCustomPersistence.ToString() + "<br>"); sb.Append("The IsDefault method returns " + p.IsDefaultAttribute().ToString()); Message.Text = sb.ToString(); } </script> <html > <head runat="server"> <title>PersistChildrenAttribute</title> </head> <body> <form runat="server"> <div> <asp:Label ID="Message" runat="server"/> <AspSample:CollectionPropertyControl id="CollectionPropertyControl1" runat="server"> </AspSample:CollectionPropertyControl> </div> </form> </body> </html>
プラットフォームWindows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照Weblioに収録されているすべての辞書からPersistChildrenAttribute.UsesCustomPersistence プロパティを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からPersistChildrenAttribute.UsesCustomPersistence プロパティ
を検索
- PersistChildrenAttribute.UsesCustomPersistence プロパティのページへのリンク