This project is read-only.

Button click handler

Topics: Writing modules
Jun 29, 2012 at 10:42 AM

I'm writing custom module that should have some settings.

Under the Admin/Settings/MyModule now I can setup all the settings using driver and EditorTemplates/Edit/MyModuleSettings.cshtml view

OK, now I want to add the button and its click handler at this page.

1) How this should be implemented? Now I have workaround in [HttpPost]Editor method of driver that checks postback control and does required job. But it seems to be dirty.

2) If I want my button to appear next to Save button, can I do this?

Jul 2, 2012 at 9:02 AM

Seems I should use controller instead of driver?

Jul 2, 2012 at 9:13 PM

That makes sense, yes. As a general rule of thumb, controllers handle the entire request, drivers handle the rendering of a single content part, not the entire request.
I think you may want to check out the Advanced Orchard course on Pluralsight, it will explain this in great detail.

Jul 3, 2012 at 4:45 AM

Thanks for guiding me!