powermax
powermax

Reputation: 3

Sharepoint Library site detection

When I go to a page in sharepoint portal. How to detect that is library page or list (not calendar or task ...)

Upvotes: 0

Views: 75

Answers (1)

Rich Bennema
Rich Bennema

Reputation: 10345

Try:

SPList list = SPContext.Current.List;
if (list.BaseTemplate == SPListTemplateType.DocumentLibrary || 
    list.BaseTemplate == SPListTemplateType.GenericList)
{
    // Current Page is associated with a Document Library or Custom List
}

Upvotes: 1

Related Questions