Copied to clipboard

Flag this post as spam?

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


  • Pathini 17 posts 107 karma points
    3 days ago
    Pathini
    0

    how to return model back to page after post submit using surfacecontroller v13

    hi all, I have surface controller, partial view form return some values on submit and the controller has some work to do and return model back to page so we can load next stage of the form .

    I'm struggling here to send the model back to page bcos return RedirectToCurrentUmbracoPage(); and return CurrentUmbracoPage(); seems to be losing the data . when page reload.

    I have assigned model to TempData["CheckerResult"] in controller but struggling to read from View again . I have tried to convert TempData back to object model it throwing an error.

    MyViewModel resultmodel =   JsonConvert.DeserializeObject<MyViewModel>(TempData["CheckerResult"]);
    

    anyone know how to pass complex models back to view and reload form page?

  • Afreed 56 posts 264 karma points
    12 hours ago
    Afreed
    0

    HI Pathini,

    Could you try using

    TempData.Keep("CheckerResult");
    

    if that doesn't work for you, try using

    Cookies, Local Storage or Session State

  • Pathini 17 posts 107 karma points
    1 hour ago
    Pathini
    0

    I'm using surface controller and render partial view using a macro inside richtext editor.

    when call submit, post action in controller load more details to model return to current page , I have access TempData from view but seems to be empty

Please Sign in or register to post replies

Write your reply to:

Draft