if I send a request with ajax to my controller I can get data ajax success. your write is right.
but I cant enter controller before render cshtml. I didnt find any doc. about this.
I want to use umbraco like MVC logic.
firstly I prepare data in controller after that I will pass data to cshtml
can I use controller before render a page?
I want to fetch some data from another DB (not umbraco DB) in controller and pass this data to cshtml (umbraco page). is it possible?
Yes, I think its very simple what you want to do.
if I send a request with ajax to my controller I can get data ajax success. your write is right. but I cant enter controller before render cshtml. I didnt find any doc. about this. I want to use umbraco like MVC logic. firstly I prepare data in controller after that I will pass data to cshtml
Umbraco is build on MVC, so every possible thing in MVC can be done in Umbraco as well.
Did you inherit UmbracoApiController on your Controller?
This topic could be intresting for you: https://our.umbraco.com/forum/developers/api-questions/45776-Calling-Surface-Controller-From-Ajax
Have you looked at render controllers?
I use these to create a model before the main view has loaded, and then surface controllers to control the partials
https://our.umbraco.com/documentation/reference/routing/custom-controllers#example-hijacking-route-requests-to-a-product-page
Hey Hakan,
You can achieve this in two way's
1) By writing an API using SurfaceController and call the API.
2) Use Umbraco Route Hijacking / Custom controller Please see here Controller
Example
Regards Dhanesh :)
thanks aaron and Regards. "Route Hijacking / Custom controller" is answer of my question I asked exactly.
is working on a reply...