Hello, i am trying to get a controller working on an document type that is listed as an element type.
I have created an data type that can call this element type.
So that on the content i can call this block dynamically if needed.
Next i have created a partial view to work with this. and calling that in the template if needed so that it only shows when i select it.
However now i need to add some custom code which i want to do with an controller that will only affect this element type. But i have no clue on how i can set this up (and if it even should be possible the way i want it.)
I did manage to get controllers working with the base document types that are not element types. But even with those i can't seem to find a way to call the element type for some custom code.
Does anyone know how i should approach this to make it working?
So, with full doc types you can route hijack them with the RenderMvcController, which is what I assume you meant you had done when you said I did manage to get controllers working with the base document type. However, as Element Types aren't routable in the same way you'd need to take a different approach.
What I would do is create a surface controller and have an action that accepts the element type as parameter. That way you can pass in your element, perform your extra logic, and then return a partial view for rendering.
Controller for document type as element type
Hello, i am trying to get a controller working on an document type that is listed as an element type. I have created an data type that can call this element type. So that on the content i can call this block dynamically if needed.
Next i have created a partial view to work with this. and calling that in the template if needed so that it only shows when i select it.
However now i need to add some custom code which i want to do with an controller that will only affect this element type. But i have no clue on how i can set this up (and if it even should be possible the way i want it.)
I did manage to get controllers working with the base document types that are not element types. But even with those i can't seem to find a way to call the element type for some custom code.
Does anyone know how i should approach this to make it working?
i hope this is clear of what i am trying to do.
Hi Sprite,
So, with full doc types you can route hijack them with the RenderMvcController, which is what I assume you meant you had done when you said
I did manage to get controllers working with the base document type
. However, as Element Types aren't routable in the same way you'd need to take a different approach.What I would do is create a surface controller and have an action that accepts the element type as parameter. That way you can pass in your element, perform your extra logic, and then return a partial view for rendering.
Nik
is working on a reply...