DeviceSpecificChoiceCollection Class

 
Note: This API is now obsolete.

Represents a collection of choices for the DeviceSpecific class. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.

Namespace:   System.Web.UI.MobileControls
Assembly:  System.Web.Mobile (in System.Web.Mobile.dll)

System.Object
  System.Web.UI.MobileControls.ArrayListCollectionBase
    System.Web.UI.MobileControls.DeviceSpecificChoiceCollection

[ObsoleteAttribute("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, 
	Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, 
	Level = AspNetHostingPermissionLevel.Minimal)]
public class DeviceSpecificChoiceCollection : ArrayListCollectionBase

NameDescription
System_CAPS_pubpropertyAll

Retrieves an array of DeviceSpecificChoice objects from the collection. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.

System_CAPS_pubpropertyCount

Returns the number of elements in a collection. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.(Inherited from ArrayListCollectionBase.)

System_CAPS_pubpropertyIsReadOnly

Gets a value indicating whether a collection is read-only. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.(Inherited from ArrayListCollectionBase.)

System_CAPS_pubpropertyIsSynchronized

Gets a value indicating whether a collection is synchronized. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.(Inherited from ArrayListCollectionBase.)

System_CAPS_pubpropertyItem[Int32]

Returns a DeviceSpecificChoice item in the collection, by index. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.

System_CAPS_protpropertyItems

Gets or sets the collection of items in an array list object. The default value is Empty. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.(Inherited from ArrayListCollectionBase.)

System_CAPS_pubpropertySyncRoot

Returns the SyncRoot object for the collection. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.(Inherited from ArrayListCollectionBase.)

NameDescription
System_CAPS_pubmethodAdd(DeviceSpecificChoice)

Adds a DeviceSpecificChoice object to the end of a collection. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.

System_CAPS_pubmethodAddAt(Int32, DeviceSpecificChoice)

Adds a choice at the location in the collection specified by the index parameter. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.

System_CAPS_pubmethodClear()

Clears the collection. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.

System_CAPS_pubmethodCopyTo(Array, Int32)

Copies the items in the collection to an array, starting at the given index. Intended for internal use only. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.(Inherited from ArrayListCollectionBase.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetEnumerator()

Retrieves an enumerator for the collection. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.(Inherited from ArrayListCollectionBase.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodRemove(DeviceSpecificChoice)

Removes the specified choice. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.

System_CAPS_pubmethodRemoveAt(Int32)

Removes the item at the specified index. This API is obsolete. For information about how to develop ASP.NET mobile applications, see the www.asp.net/mobile Web site.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubmethodAsParallel()

Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)

System_CAPS_pubmethodAsQueryable()

Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.)

System_CAPS_pubmethodCast<TResult>()

Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.)

System_CAPS_pubmethodOfType<TResult>()

Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.)

Accessing the Choices property of a DeviceSpecific object retrieves a DeviceSpecificChoiceCollection object. This collection implements the ICollection interface (through the ArrayListCollectionBase object); it implements all properties and methods of the ICollection interface.

The following code example shows how to use the DeviceSpecificChoiceCollection class to gain access to the choices in a DeviceSpecific/Choice construct. For your convenience, a Web.config file containing the filters follows the example code.

System_CAPS_noteNote

The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information, see ASP.NET Web Forms Page Code Model.

<%@ Page Language="C#" 
    Inherits="System.Web.UI.MobileControls.MobilePage" %>
<%@ Register TagPrefix="mobile" 
    Namespace="System.Web.UI.MobileControls" 
    Assembly="System.Web.Mobile" %>
<%@ Import Namespace="System.Web.Mobile" %>

<script runat="server">
    public void Page_Load(Object sender, EventArgs e)
    {
        int count = this.Panel1.DeviceSpecific.Choices.Count;

        // Cycle through the DeviceSpecificChoiceCollection.
        for (int i = 0; i < count; i++)
        {
            string txt1 = "Choice {0} has {1} Templates. ";
            string txt2 = "Filter name is '{0}'. ";

            Label1.Text += String.Format(txt1, i,
                Panel1.DeviceSpecific.Choices[i].Templates.Count);
            Label2.Text += String.Format(txt2,
                Panel1.DeviceSpecific.Choices[i].Filter);
        }
    }

    // Add a DeviceSpecificChoice section programatically
    protected void form1_Init(object sender, EventArgs e)
    {
        DeviceSpecific devSpecific = Panel1.DeviceSpecific;
        DeviceSpecificChoice devChoiceHtml = new DeviceSpecificChoice();
        devChoiceHtml.Filter = "isCHTML10";
        devSpecific.Choices.Add(devChoiceHtml);
        ((IParserAccessor)form1).AddParsedSubObject(devSpecific);
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
    <mobile:Form ID="form1" Runat="server" OnInit="form1_Init">
        <mobile:Panel id="Panel1" Runat="server">
            <mobile:DeviceSpecific Runat="server">
                <Choice Filter="isHTML32">
                    <ContentTemplate>
                        <!-- For HTML Browsers -->
                        <br />
                        <mobile:Label ID="Label3" Runat="server" 
                            Text="Visible in an HTML Browser" />
                        <br />
                    </ContentTemplate>
                </Choice>
                <Choice Filter="isWML11">
                    <ContentTemplate>
                        <!-- For WML Browsers -->
                        <br />
                        <mobile:Label ID="Label4" Runat="server" 
                            Text="Viewable in a WML browser" />
                        <br />
                    </ContentTemplate>
                </Choice>
            </mobile:DeviceSpecific>
        </mobile:Panel>
        <mobile:Label id="Label1" Runat="server" Font-Bold="true" />
        <mobile:Label ID="Label2" Runat="server" Font-Bold="true" />
    </mobile:Form>
</body>
</html>

AspNetHostingPermission

for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.

AspNetHostingPermission

for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.

.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

DeviceSpecificChoice
System.Web.UI.MobileControls Namespace
Introduction to the DeviceSpecific Control
<DeviceSpecific> Element
<Choice> Element

Return to top
Show: