Export (0) Print
Expand All

ListAdministrationSelector class

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

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)

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

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

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)
        {
        }

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

Community Additions

Show:
© 2014 Microsoft