This topic has not yet been rated - Rate this topic

ListAdministrationSelector Class

SharePoint 2010

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)
Available in Sandboxed Solutions: No
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class ListAdministrationSelector : ContextSelector<SPList>

ListAdministrationSelector requires that SiteSelector and WebSelector are not null.

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.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ