---
schema_version: "1"
id: ccd4dea25dbc736a2b0cfac2e82b3dc81f628ede569cee6a36939410478d9153
title: Setting Read-Only Mode for Controller Methods
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/controller/pages-controller-readonly-context-methodlevel.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-readonly-context-methodlevel.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: ee5830d938dbaf4cf0383de8cd3624667f6edecf60d7ad47a3f6d6e081f3e143
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# Setting Read-Only Mode for Controller Methods

Visualforce controller methods can, with some important limitations, use the Apex `ReadOnly` annotation, even if the page itself isn’t in read-only mode.

Visualforce controller methods with the `@ReadOnly` annotation automatically take advantage of read-only mode.. However, restrictions on the `@ReadOnly` annotation means that, for Visualforce controller methods, a read-only method must also have the `@RemoteAction` annotation. The `@RemoteAction` annotation requires that the method be:

-   Either `global` or `public`
-   `static`

Enabling read-only mode. by using the `@ReadOnly` annotation must be done on the top level method call. If the top level method call doesn’t have the`@ReadOnly` annotation, the normal restrictions on maximum queried rows are enforced for the entire request, even if secondary methods are annotated with `@ReadOnly`.

Using the `@ReadOnly` annotation on a controller method allows you to retrieve a larger collection of records as the result of a Visualforce expression. However, it doesn’t increase the maximum number of items in a collection for iteration components. If you want to iterate over larger collections of results, you need to enable read-only mode. for the entire page.

**See Also**  


-   [Setting Read-Only Mode for an Entire Page](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-readonly-context-pagelevel.md)
-   [*Apex Developer Guide*: ReadOnly Annotation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_ReadOnly.htm)

