This case arises from a dispute between members of the Allen family over ownership of certain land and a rental house (the property) located in Jackson County (the county). Plaintiff sought a judgment declaring him owner of the property and ordering an accounting and that defendant deed the property to him. The trial court granted summary judgment for defendant, and plaintiff appeals. We agree with plaintiff that the trial court erred and reverse and remand.
In January 1978, Jess and Aldura Allen acquired the property as tenants by the entirety. In July 1978, the couple obtained a Decree of Unlimited Separation that awarded the property to Jess Allen free of any interest of Aldura Allen. The decree also stated that, if the parties did not execute the documents necessary to effectuate its terms, then the decree would be self-executing. Apparently, the necessary documents were never executed, but the decree was entered in the county’s records.
Jess Allen died on May 1, 1989, leaving as his devisees Aldura Allen and their children, Ricky Allen, Renee Peters, and plaintiff.1 Jess’s will stated that plaintiff should take the property, that Aldura should take certain money from a promissoxy note, that Renee should take nothing, and that Ricky should take the residue and serve as personal representative of the estate.2 Ricky instituted a probate proceeding in Jackson County on June 8,1989. For reasons unstated in the record, however, the property was not included in the inventory of assets and was not disposed of in the probate proceeding. In the petition for probate, Ricky stated that the estate amounted to only $31,194.75 — the value of the promissoxy note. With the exception of the statutory compensation that Ricky received as personal representative of the estate, the only asset distributed from the estate was the promissory note, which Aldura took. Notices were sent to plaintiff *423regarding the probate proceedings on June 13, 1989, but plaintiff took no part in them. A decree of distribution that made no mention of the property was recorded on November 15,1989.
In March 2000, Aldura executed an affidavit stating that Jess, with whom she asserted she had owned the property as tenants by the entirety, was deceased. Ostensibly that step was taken to ensure that Aldura would have sole ownership of the property. One year later, by deed signed March 7, 2001, and recorded April 2, 2001, Aldura purported to transfer the property to herself as trustee of the Allen Family Trust. Aldura subsequently died and Renee became successor trustee of the Allen Family Trust. Pursuant to the terms of the trust, Renee purported to transfer the property to Ricky in July 2003. In an affidavit, plaintiff stated that he never knew the property existed until October 2003, when he first became aware of his parents’ legal separation.
In March 2004, plaintiff filed this action seeking a judgment declaring him owner of the property and ordering an accounting and that defendant deed the property to him.3 Plaintiffs complaint stated in the caption that it was an action for declaratory judgment under the Uniform Declaratory Judgments Act, ORS 28.010 to 28.160. See Ken Leahy Construction, Inc. v. Cascade General, Inc., 329 Or 566, 572, 994 P2d 112 (1999) (“The jurisprudence of this court is well-settled that, under ORS 28.010, ORS 28.020, and ORS 28.030, * * * a trial court can, on a proper showing, declare a party to be the owner of property.”); Winthers v. Bertrand, 239 Or 97, 396 P2d 570 (1964) (illustrating that principle); however, the caption also contained the following words: “QUIET TITLE TO REAL PROPERTY.” Defendant moved to dismiss the complaint under ORCP 21, arguing that plaintiffs claim was barred by the applicable statute of limitations *424and by laches, that plaintiff failed to allege certain facts necessary to a claim to quiet title, and that plaintiff had failed to join a necessary party to the action: Ricky, who now has possession of the property. We describe each of those arguments in turn.
As an initial matter, we note that defendant did not cite specific provisions of ORCP 21 in its motion to dismiss; that is unfortunate because doing so simplifies the issues for both the parties and the court. Moreover, as this case illustrates, not all motions to dismiss are the same: some involve an expanded sphere of evidence on which the parties may rely, and which may prove dispositive to the motion and the way in which it is treated.
Defendant first argued in its motion to dismiss that plaintiffs claim is barred by the applicable statute of limitations, here, ORS 12.0404 and ORS 12.0505 (setting forth a 10-year period), and by laches. See Frasier v. Nolan, 195 Or App 211, 215, 98 P3d 392 (2004) (stating that courts often look to analogous statutes of limitations in determining whether a claim is barred by laches). Specifically, defendant argued that plaintiff should have filed his complaint within 10 years of Jess’s 1989 death, or at least within 10 years of the close of probate (later that year). Defendant noted that plaintiff did not file his complaint until March 2004. Defendant also asserted that plaintiff had constructive knowledge of the relevant facts, having been “given all notices required by law” in the probate proceeding. Defendant’s first argument can best be characterized as an ORCP 21 A(9) (statute of limitations) argument.6
Defendant next argued that plaintiff’s complaint was insufficient in that it failed to allege that the property was in his possession, such allegation being necessary to a *425claim to quiet title. See ORS 105.605 (“Any person claiming an interest or estate in real property not in the actual possession of another may maintain a suit in equity against another who claims an adverse interest or estate therein for the purpose of determining such conflicting or adverse claims, interests or estates.” (Emphasis added.)). That argument is best characterized as falling under ORCP 21 A(8) (failure to state ultimate facts sufficient to constitute a claim).7 Finally, defendant argued that it is no longer in possession of the property and that, because Ricky is, Ricky is a necessary party to plaintiff’s action, and plaintiffs failure to join him constituted grounds for dismissal. That argument falls under ORCP 21 A(7) (failure to join a party). Defendant’s motion to dismiss also indicated that it was “supported by the affidavit of Renee,” which included allegations pertaining to each of defendant’s arguments.
Plaintiff responded by arguing that Renee’s affidavit should not be allowed because she had no personal knowledge of the matters discussed in her affidavit and that her opinions were irrelevant. Plaintiff also submitted his own affidavit, which touched on defendant’s ORCP 21 A(9) argument by alleging that plaintiff did not know that the property existed until October 2003. In addition, plaintiff indicated in his opposition to defendant’s motion that he was unaware of Ricky’s possession of the property until he received the motion to dismiss, and that his lack of knowledge was the reason for his failure to join Ricky as a party or name him in the action. Specifically, plaintiff indicated that an initial title search had not revealed the transfer of the property from the trust to Ricky, and that plaintiff had conducted another search and found the transfer only after receiving defendant’s motion. Plaintiff offered to amend the complaint to include Ricky and to strike the reference to a quiet title action from the caption.
*426After farther briefing, the trial court granted defendant’s motion, stating:
“1. The motion to dismiss is more accurately termed a motion for summary judgment. Supporting affidavits have been filed by the parties which would more appropriately support such a motion.
“2. Both parties treated the matter as a summary judgment.
“3. Laches does apply in this case.”
In particular, the court found that plaintiff had delayed “an unreasonable length of time in asserting his claim”; that plaintiff knew “of the relevant facts because he was presumptively served with copies of the probate petition”; and that defendant would be prejudiced if the action were allowed to proceed because “it would be inequitable for the Court to grant relief in these circumstances.”
On appeal, plaintiff makes three assignments of error. In his first assignment of error, plaintiff argues that the trial court erred in treating defendant’s motion to dismiss as a motion for summary judgment.
We begin our analysis with a few preliminary points. First, error is preserved in a case where, as here, a court treats a motion to dismiss as a motion for summary judgment and fails to give the party against whom judgment is rendered an opportunity to respond. Ames v. Hill, 203 Or App 30, 33-34, 125 P3d 24 (2005). Second, although rulings made under ORCP 21 A(8) and A(9) must confine themselves to the facts alleged in the complaint, Black v. Arizala, 337 Or 250, 265-66, 95 P3d 1109 (2004) (so holding for ORCP 21 A(8)); Press v. Todd Investment Co., 98 Or App 93, 96, 778 P2d 506 (1989) (so holding for ORCP 21 A(9)), rulings made under ORCP 21 A(7) may make reference to affidavits, declarations, and other evidence submitted by the parties. Black, 337 Or at 265-66. Finally, where, as here, a party moves to dismiss both on grounds allowing reference to evidence outside the complaint and on grounds prohibiting such reference, and evidence outside the complaint is submitted, courts must be careful to confine their review appropriately with regard to each ground upon which the motion is based.
*427On the one hand, we have held repeatedly that it is improper to grant summary judgment sua sponte. See Advance Resorts of America, Inc. v. City of Wheeler, 141 Or App 166, 180, 917 P2d 61 (1996) (court improperly granted summary judgment for defendant when only plaintiff had submitted a motion for summary judgment); Francis v. Eoff Electric Co., 127 Or App 632, 638-39, 873 P2d 1110 (1994) (court improperly granted summary judgment, in essence, and dismissed case based on motion brought under ORCP 17); Harbert v. Riverplace Associates, 114 Or App 80, 83, 834 P2d 476 (1992) (court improperly granted summary judgment absent any motion); Hendgen v. Forest Grove Community Hospital, 98 Or App 675, 677, 780 P2d 779 (1989) (court improperly granted summary judgment on claim different from that raised in summary judgment motion); Industrial Underwriters v. JKS, Inc., 90 Or App 189, 190, 750 P2d 1216 (1988) (court improperly invited oral motion for summary judgment and then granted it); cf. Glorioso v. Ness, 191 Or App 637, 642-43, 83 P3d 914 (2004) (court properly granted summary judgment after defendants, in their briefing, enlarged on an argument they had raised in their motion for summary judgment).
On the other hand, we have treated a motion to dismiss, even one limited to the pleadings, as a motion for summary judgment when the parties themselves treated the motion to dismiss as a motion for summary judgment. See L. H. Morris Electric v. Hyundai Semiconductor, 203 Or App 54, 61-63, 125 P3d 1 (2005), rev den, 341 Or 140 (2006) (treating motion to dismiss brought under ORCP 21B (judgment on the pleadings) as a motion for summary judgment where both parties submitted evidence outside the pleadings, without objection, and the trial court relied on that evidence in its ruling); Kelly v. Olinger Travel Homes, Inc., 200 Or App 635, 641, 117 P3d 282 (2005) (same); cf. Greeninger v. Cromwell, 127 Or App 435, 439, 873 P2d 377 (1994) (court improperly treated motions for summary judgment as motions to dismiss absent parties’ consent).
Here, the trial court based its decision solely on defendant’s ORCP 21 A(9) argument, treating the motion to dismiss as a motion for summary judgment in that regard, and relying on affidavits submitted by the parties to grant *428the motion as so construed. Plaintiff contends that the trial court erred in transforming defendant’s motion to dismiss into a motion for summary judgment based on the parties’ reliance on affidavits. Plaintiff argues that the existence of those affidavits, by itself, was not sufficient to convert the motion to dismiss into a motion for summary judgment because ORCP 21 A(7), on which defendant based one of its arguments, allows for such evidence even if ORCP 21 A(8) and A(9), also relied on by defendant, do not. See Black, 337 Or at 265-66 (mere reliance on facts outside the pleadings does not transform a motion to dismiss brought under ORCP 21 A(l) through A(7) into a motion for summary judgment); Industrial Leasing Corp. v. Miami Ice Machine Co., 126 Or App 80, 83-84, 867 P2d 548 (1994) (court properly refused to treat motion to dismiss brought under ORCP 21 A(2) as motion for summary judgment merely because the moving party relied on evidence outside the pleadings). Plaintiff also contends more generally that neither party treated the motion to dismiss as one for summary judgment. We disagree.
This is not a case where the affidavits relied on by the parties spoke only to defendant’s ORCP 21 A(7) argument — the necessity of joining Ricky as a party. In such a case, it might be error for a court to rely on those affidavits when it bases its ruling on an ORCP 21 A(9) argument. Here, however, the affidavits spoke to all of defendant’s arguments, including its ORCP 21 A(8) argument — concerning plaintiffs alleged need to plead possession of the property — and its ORCP 21 A(9) argument — concerning the timeliness of plaintiffs claim. Because the affidavits spoke to the issues addressed by defendant’s ORCP 21 A(8) and A(9) arguments — arguments otherwise limited to the facts alleged in the complaint — and because neither party objected to the court’s relying on the affidavits on that ground,8 the trial *429court properly could conclude that the parties were treating defendant’s motion to dismiss as a motion for summary judgment with regard to those arguments. See L. H. Morris Electric, 203 Or App at 62-63 (so holding under similar circumstances). Treating the motion as one for summary judgment, the court could rely on the parties’ affidavits to rule on defendant’s laches claim, which is what the court did.
Our conclusion that the trial court did not err in treating defendant’s motion to dismiss as a motion for summary judgment requires us to analyze plaintiffs third assignment of error, which asserts that defendant was not entitled to summary judgment because genuine issues of material fact existed. See ORCP 47 C (“The court shall enter judgment for the moving party if the pleadings, depositions, affidavits, declarations and admissions on file show that there is no genuine issue as to any material fact and that the moving party is entitled to a judgment as a matter of law.”). Because we treat the motion to dismiss as one for summary judgment, we must “ ‘view the record in the light most favorable to [plaintiff as the nonmoving party] to determine whether a genuine issue of material fact exists and, if not, whether [defendant] is entitled to judgment as a matter of law.’ ” L. H. Morris Electric, 203 Or App at 63 (quoting Kelly, 200 Or App at 641).
We first consider whether laches or a statute of limitations governs our resolution of this case; that inquiry turns on whether this action lies in equity or at law. “Whether a declaratory judgment proceeding is treated as a legal or equitable proceeding depends on the nature of the underlying claim and the relief sought.” Frasier, 195 Or App at 217. Here, plaintiff sought a declaration of rights, an injunction requiring defendant to deed the property to plaintiff, and an accounting. We hold that plaintiffs claim lies in equity and that, therefore, laches applies. See Ken Leahy Construction, Inc., 329 Or at 570-71 (holding that a claim is equitable where it seeks declaratory and injunctive relief).
In Frasier, we stated:
“A claim in equity is subject to the doctrine of laches, which dictates that a party may not delay in asserting a claim for *430an unreasonable amount of time after obtaining full knowledge of the relevant facts when the delay results in substantial prejudice to the opposing party. Courts often look to an analogous statute of limitations to define a ‘presumptively reasonable period’ within which one may file a claim in equity.”
195 Or App at 215 (citation omitted).
Here, the trial court found that plaintiff had “knowledge of the relevant facts because he was presumptively served with copies of the probate petition.” Defendant similarly cites the transfers of the property from Aldura to the trust and from the trust to Ricky as evidence that plaintiff had constructive notice of others’ claims to the property. We have held repeatedly, however, that “Constructive notice of the relevant facts is not sufficient to trigger whatever statute of limitation serves as the presumptively reasonable period.” Id. at 216. Instead, “actual notice” is required in the form of “full knowledge of the relevant facts.” Id. at 215, 217; see also Rise v. Steckel, 59 Or App 675, 684, 652 P2d 364 (1982) (requiring “full knowledge of all relevant facts”).
There is evidence in the record indicating that plaintiff had actual notice of a claim to or interest in the property that was adverse to his. That evidence includes a statement contained in an affidavit made by Renee (“Plaintiff knew that [Aldura] considered the property to be hers and that she was in possession of it.”), as well as other statements contained in a second affidavit made by Renee to the effect that plaintiff had admitted that he received notice of the probate proceedings and that he chose not to contest the probate and “did not want any part of Jess Allen’s estate.” The latter statements are supported by an e-mail attached to Renee’s second affidavit. All of that evidence is contradicted, however, by plaintiffs affidavit, in which he stated that he was unaware of the existence of the property, let alone any adverse claims to it, until October 2003. That contradiction is central to our resolution of this case because it creates a genuine issue of material fact as to when plaintiff first obtained full knowledge of all facts relevant to his claim for ownership of the property. Without knowing when that occurred, we cannot say, as a matter of law, that plaintiffs claim is barred by laches, unless we conclude that plaintiff delayed asserting his claim for an unreasonable amount of time by waiting from October 2003 *431until March 2004 to file his complaint. We conclude that plaintiffs delay during that period was not unreasonable. Therefore, the trial court erred in granting summary judgment for defendant.
The trial court’s error requires us to remand this case to that court for further proceedings. On remand, the trial court will have before it the remaining arguments contained in defendant’s motion to dismiss: those based on ORCP 21 A(7) and A(8). We take the opportunity now to address the ORCP 21 A(7) argument because it presents a jurisdictional issue. See Vance v. Ford, 187 Or App 412, 425, 67 P3d 412 (2003) (“Failure to join a necessary party in a declaratory judgment action deprives the court of authority to render a judgment that binds that party; it is considered a jurisdictional defect.”); see also ORS 28.110 (“When declaratory relief is sought, all persons shall be made parties who have or claim any interest which would be affected by the declaration, and no declaration shall prejudice the rights of persons not parties to the proceeding.”). In this case, Ricky is in present possession of the property and has a claim to ownership. He is therefore a necessary party and failure to join him constitutes a jurisdictional defect. Defendant’s motion to dismiss under ORCP 21 A(7) should be granted. Accordingly, we remand to the trial court with instructions to dismiss plaintiffs claim unless Ricky is joined as a party within a time to be set by the trial court. See Wright v. Hazen Investments, Inc., 293 Or 259, 266, 648 P2d 360 (1982) (so doing in similar circumstances); Vance, 187 Or App at 425 (same).9
In summary, we hold that the trial court did not err in treating defendant’s motion to dismiss as a motion for summary judgment insofar as it related to defendant’s ORCP *43221 A(9) argument. However, we also hold that the trial court did err in granting summary judgment for defendant based on that argument. Finally, we hold that defendant’s motion to dismiss under ORCP 21 A(7) must be granted, and we remand with instructions to dismiss plaintiffs claim unless Ricky is joined as a party within a time to be set by the trial court.
Reversed and remanded.
For clarity, in the remainder of this opinion we refer to all members of the Allen family, except plaintiff, by their first names.
The will was executed in January 1988. One month later, Ricky petitioned for appointment as and became Jess’s guardian and conservator. The petition appears to have listed as assets both the property and rental income from it.
We note that plaintiff s request for a transfer of the property seems somewhat inconsistent with his claim of ownership in the property; either plaintiff now owns the property and requires no deed transfer, or he does not now own the property and a deed transfer would be necessary to give him ownership. We also note, without expressing an opinion on the matter, that plaintiffs request for a transfer of the property seems unnecessary in light of the terms of the Decree of Unlimited Separation and ORS 114.215 (providing that title to a decedent’s property vests in any devisees upon the death of the decedent).
ORS 12.040(1) provides that “a suit for the determination of any right or claim to or interest in real property shall be deemed within the limitations provided for actions for the recovery of the possession of real property.”
ORS 12.050 provides that “[a]n action for the recovery of real property, or for the recovery of the possession thereof, shall be commenced within 10 years.”
Even though ORCP 21 A(9) does not mention laches, but only statutes of limitations, we have construed arguments based on laches as falling under the aegis of the rule. See Frasier, 195 Or App at 214-15.
We note that, despite the complaint’s somewhat misleading caption, it is clear that it was brought under the Uniform Declaratory Judgments Act and was not an action to quiet title, as plaintiff emphasized in subsequent briefing before the trial court. Cf. Welker v. TSPC, 332 Or 306, 312, 27 P3d 1038 (2001) (holding that “a motion is controlled by its substance, not its caption”). Accordingly, it was not necessary for plaintiff to plead actual possession of the property. See Erwin v. Oregon State Bar, 149 Or App 99, 106, 941 P2d 1094 (1997) (“[A] failure to state a claim is not a proper basis for dismissing a declaratory judgment action.”).
The only objection to either party’s affidavits came from plaintiff, and that objection was based solely on the relevancy and materiality of the allegations contained in Renee’s affidavit. Neither of those contentions was based on an assertion that the court could not consider the affidavit in the context of a motion brought under ORCP 21 A(9). Accordingly, plaintiff’s objection to the use of Renee’s affidavit does not show that he did not want to treat the motion to dismiss as one for summary judgment. See L. H. Morris Electric, 203 Or App at 61-62 (party “never suggested that the trial court should have limited its consideration only to the pleadings”).
Plaintiff contends in his second assignment of error that the trial court abused its discretion under ORCP 21 A in failing to grant him leave to file an amended complaint given his assertions that he did not learn either of Ricky’s possession of the property or of Ricky’s potential claim to ownership until he received defendant’s motion to dismiss. Normally, our review of such a question would be for abuse of discretion. OTECC v. Co-Gen, 168 Or App 466, 485, 7 P3d 594 (2000), rev den, 332 Or 137 (2001). We decline to analyze plaintiffs second assignment of error, however, because it is based on a false assumption: that the trial court exercised its discretion on this matter in this case. It is not true here that the trial court granted defendant’s motion to dismiss and then denied plaintiff leave to amend his complaint. Rather, the trial court granted summary judgment for defendant and, therefore, did not consider whether to grant plaintiff leave to amend his complaint. There is no exercise of trial court discretion for us to review.