Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jerode 44 posts 159 karma points
    Jun 20, 2013 @ 01:36
    Jerode
    0

    Execute usercontrol routine from cshtml.

    I may be going about this incorrectly so feedback is welcomed. A large base of .ascx usercontrols would like to be included in a Umbraco 6.1.1 web. The rendering mode is mvc so no problems rending the macro and displaying what is on the control and executing actions when the buttons on the controls exist.

    @Umbraco.RenderMacro("MyCustomControl")

    The issue I have is that MyCustomControl has public routines that are exposed such as SaveData. The control has no buttons because in the previous application the parent page would call those events. The aspx.cs call would be like

    if (valid) this.MyCustomControl1.SaveData();
    myId = this.MyControl.ResourceId; // Id of the saved data, -1 otherwise
    ...

    How can I call these routines in a MVC page? I may have multiple controls on one page and would like to have a single submit button for them as well.

    I don't have the resources at this time to convert all the controls before launching. Can someone advise the way to execute routines in a usercontrol using a Umbraco template/cshtml file?

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Jun 20, 2013 @ 17:21
    Dave Woestenborghs
    0

    Can I ask why you are switching to MVC when you have a large base of usercontrols that depend on masterpages calling routines?

    Wouldn't it be better to use the webforms engine instead ?

     

  • Jerode 44 posts 159 karma points
    Jun 20, 2013 @ 18:09
    Jerode
    0

    The initial Umbraco site is MVC and is stable. The next phase is migrating the functionality of a previous non Umbraco site to this new Umbraco site. I have no problem updating the user controls to MVC, I just don't think it can all be done before migrating for launch. 

Please Sign in or register to post replies

Write your reply to:

Draft