Copied to clipboard

Flag this post as spam?

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


  • ram 4 posts 34 karma points
    May 14, 2015 @ 12:09
    ram
    0

    How to use web form usercontrol in razor view

    I Need to connect my webservice into my umbraco website , so i found the technique adding web form  .ascx user controls in umbraco 6.1.6 . but in umbraco 7.2.4 using razor engine , my user control only displayed but buttons not working. i cant creat a user contol with razor script and cant add a razor script page.  

  • Urvish 252 posts 776 karma points
    May 14, 2015 @ 12:38
    Urvish
    100

    Hi Ram,

    For Umbraco 7.2.4 you need to convert that UserControl into partial view.

    Otherwise you need to change your DefaultRenderEngine to WebForms.

    Then you will be able to use UserControl.

    I think the best way is to convert your usercontrol into partial view.

    Hope it will help.

    Regards,

    Urvish Mandaliya

  • ram 4 posts 34 karma points
    May 15, 2015 @ 09:04
    ram
    0

    hi Urvish,

    thanks you very much. it's great.

    that is fine, now my user control works.

    if  i create a view in visual studio means, how to get it  in umbraco.

    i tried to create a view and partial view in visual studio project of umbraco nuget installed.

    after running it i cant see the view page in umbraco developer(macro) section.

    please give me a solution.

    Actually i need to connect my webservice with umbraco application.

    the user entries will send to MSSQL Data Base.

    please provide any useful tips.

  • Urvish 252 posts 776 karma points
    May 15, 2015 @ 10:47
    Urvish
    0

    Hi Ram,

    If you want to see the partial view in macro,

    then you need to create view in Partial View Macro Files folder from the Developer section in Umbraco.

    Or else you can also create your view on this path.

    ~/Views/MacroPartials/YourView.cshtml

    Hope it helps.

    Regards,

    Urvish Mandaliya

  • ram 4 posts 34 karma points
    May 15, 2015 @ 16:06
    ram
    0

    Hi Urvish,

     

    I can create a view in developer section,

    but how can use the controller and model from my visual studio

    to developer section view.cshtml file

  • Urvish 252 posts 776 karma points
    May 18, 2015 @ 09:20
    Urvish
    0

    Hi Ram,

    You need to create macro file of that view in developer section.

    Then you can call macro in view.cshtml like below.

    @Umbraco.RenderMacro("MacroAlias")
    

    You can also call that macro in controller like below.

    umbraco.presentation.templateControls.Macro macro = new umbraco.presentation.templateControls.Macro();
    

    You need to pass Alias and other thing s you want in that macro object. Frankly speaking I haven't used this way of rendering macro from controller.

    Hope this will help.

    Regards,

    Urvish Mandaliya

Please Sign in or register to post replies

Write your reply to:

Draft