ListAdministrationSelector Class

Allows a user to select a list from a given site collection and Web site.

Inheritance Hierarchy

System.Object
  System.Web.UI.Control
    System.Web.UI.WebControls.WebControl
      Microsoft.SharePoint.WebControls.ContextSelector<SPList>
        Microsoft.SharePoint.WebControls.ListAdministrationSelector

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class ListAdministrationSelector _
    Inherits ContextSelector(Of SPList)
'Usage
Dim instance As ListAdministrationSelector
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class ListAdministrationSelector : ContextSelector<SPList>

Remarks

ListAdministrationSelector requires that SiteSelector and WebSelector are not a null reference (Nothing in Visual Basic).

Examples

The following example shows how to create the .aspx file for a Web page that uses the list administration selector control.

          <table>
            <tr>
              <td align="right">
            <SharePoint:SiteAdministrationSelector
                id="SiteSelector"
                AllowAdministrationWebApplication="false"
                OnContextChange="OnSiteContextChange"
                runat="server" />
              </td>
            </tr>
            <tr>
              <td align="right">
            <SharePoint:WebAdministrationSelector
                id="WebSelector"
                OnContextChange="OnWebContextChange"
                runat="server" />
              </td>
            </tr>
            <tr>
              <td align="right">
                <SharePoint:ListAdministrationSelector
                    id="ListSelector"
                    OnContextChange="OnListContextChange"
                    runat="server" />
              </td>
            </tr>
          </table>

The following example shows how to handle the events for the list administration control used on the Web page in the previous example.

        protected void OnSiteContextChange(object sender, EventArgs e)
        {
            SiteAdministrationSelector siteSelect =
                (SiteAdministrationSelector)sender;

            if (String.IsNullOrEmpty(siteSelect.CurrentId))
            {
                WebSelector.Enabled = false;
            }
            else
            {
                WebSelector.Enabled = true;
            }
        }

        protected void OnWebContextChange(object sender, EventArgs e)
        {
            WebAdministrationSelector webSelect =
                (WebAdministrationSelector)sender;

            if (String.IsNullOrEmpty(webSelect.CurrentId))
            {
                ListSelector.Enabled = false;
            }
            else
            {
                ListSelector.Enabled = true;
            }
        }

        protected void OnListContextChange(object sender, EventArgs e)
        {
        }

Thread Safety

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

See Also

Reference

ListAdministrationSelector Members

Microsoft.SharePoint.WebControls Namespace