Reputation: 3
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
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