as Manish mentioned you could send the form via ajax to a SurfaceController and then process the form.
Or you have to make a post request to a SurfaceController. Then you have to use BeginUmbracoForm to set up the routing where the data should be posted to.
Hi thanks for reply. I just start learning umbraco few days ago. just to check, if i need to create controller, is that necessary need to use visual studio or other editor ? Currently i am using Umbraco cloud and back office for the project. If i can create controller through back office, any document i can refer or any guide how to create controller through back office ?
I don't think that you can create controller with umbraco cloud , i advice you to use Visual studio, the persons who use just umbraco cloud are obliged to write there code in the view which i don't think it's very appropriate, anyway if you are still new with umbraco i don't thing there is better guide than https://www.youtube.com/watch?v=VWy2HlRDCRM&list=PL90L_HquhD--OWQNLyO1-KRxVDd0NPBfZ ( Paul Seal ) those videos helped me a lot, hoping it will help you too.
Thanks. your comment really help me a lot. At least i know now i have to use Visual Studio instead of keep searching on the net for umbraco cloud how to create controller.
You don't HAVE to use Visual Studio (although it is great for MVC). You can create controller in eg. /App_Code/Controllers/, models in /App_Code/Models/ and so forth just as you can with any other .Net application. Cloud is not different in that sense, it is "just" an installation of Umbraco ☺️
My bad :/ Your class files should be in the /App_Code/ folder. They will be compiled at runtime.
So instead of creating *.cs in /Models/ and /Controllers/ they should be in /App_Code/. Will also work with sub directories, so you can do /App_Code/Models/ and /App_Code/Controllers/ to make things a little more clean.
how to add c# code behind for a partial view
Hi, i have below partial views for user login. I need to execute some c# code when the login button click, can someone guide on how to do it.
Thanks.
You can write Ajax call on click event.
Thanks
Hi Wilson,
as Manish mentioned you could send the form via ajax to a SurfaceController and then process the form.
Or you have to make a post request to a SurfaceController. Then you have to use
BeginUmbracoForm
to set up the routing where the data should be posted to.Regards David
Hi, the requirements is c# is needed for the solution not ajax.
You can call a controller which have code of c# using Ajax. Hope you got my point.
Hi.
you can create a controller who inherit from SurfaceController
in ur view u will have something like this :
and in ur controller something like this :
in my GetMembers i m getting data from another database so you can just change it from where you want
Hope it helped you.
Best Regards.
can you share with me how you show
TempData["Status"]
in your template ?
the entire view :
Hi thanks for reply. I just start learning umbraco few days ago. just to check, if i need to create controller, is that necessary need to use visual studio or other editor ? Currently i am using Umbraco cloud and back office for the project. If i can create controller through back office, any document i can refer or any guide how to create controller through back office ?
Hi Wilson,
I don't think that you can create controller with umbraco cloud , i advice you to use Visual studio, the persons who use just umbraco cloud are obliged to write there code in the view which i don't think it's very appropriate, anyway if you are still new with umbraco i don't thing there is better guide than https://www.youtube.com/watch?v=VWy2HlRDCRM&list=PL90L_HquhD--OWQNLyO1-KRxVDd0NPBfZ ( Paul Seal ) those videos helped me a lot, hoping it will help you too.
Best Regards.
Hi John
It's not true that you need to write all your code in the view when using Umbraco Cloud.
You can use VS without any problems. : https://our.umbraco.org/documentation/Umbraco-Cloud/Set-Up/Visual-Studio/
Dave
Thanks. your comment really help me a lot. At least i know now i have to use Visual Studio instead of keep searching on the net for umbraco cloud how to create controller.
thanks a lot.
Hi Wilson
You don't HAVE to use Visual Studio (although it is great for MVC). You can create controller in eg.
/App_Code/Controllers/
, models in/App_Code/Models/
and so forth just as you can with any other .Net application. Cloud is not different in that sense, it is "just" an installation of Umbraco ☺️There is an exampple of how to do this in the Getting Started docs: https://our.umbraco.org/documentation/Getting-Started/Code/Creating-Forms/
Hope that helps!
/Rune
Hi Rune Hem Strand.
Would like to know how would you generate the dll without VS?
Best regards
That is a wonderful question!
My bad :/ Your class files should be in the
/App_Code/
folder. They will be compiled at runtime.So instead of creating *.cs in
/Models/
and/Controllers/
they should be in/App_Code/
. Will also work with sub directories, so you can do/App_Code/Models/
and/App_Code/Controllers/
to make things a little more clean.Sorry for the confusion!
is working on a reply...