Add two OnGet method in a Razor page #32064
Replies: 1 comment
-
CoPilot suggests: Here’s how you can achieve this: Named Handler Methods: public class MyPageModel : PageModel
} This makes the handler name part of the route, but it won’t appear in the URL unless explicitly specified. Learn more learnrazorpages.com mikesdotnetting.com stackoverflow.com talkingdotnet.com |
Beta Was this translation helpful? Give feedback.
-
Hi Team,
Can we add multiple OnGetAsync in a Razor page.
One might be OnGetAsync , other one might be OnGetTestAsync
I am trying to avoid if else condition inside the main OnGetAsync. The route itself define which OnGet need to serve.
Note: with query string its achievable but , ppl can see the handler name in the url , which i don't want .
Beta Was this translation helpful? Give feedback.
All reactions