+1-888-365-2779
Try Now
More in this section

Forums / Project Feather / Using LoginStatus as a partial view

Using LoginStatus as a partial view

3 posts, 0 answered
  1. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    17 May
    Link to this post

    I am trying to load the Login Status widget into another view.

    I can get the default template to show up, but would like to know if it is possible to pass initialization properties as well.

    If I put @Html.Action("Index", "LoginStatus") into my view I can see that LoginStatus.LoginButton.cshtml is loading markup, but I get no functionality due to not setting the loginpageid and other properties.

     

    I tried this type of format without any luck:

    @Html.Action("Index", "LoginStatus", new { TemplateName = "LoginName", LoginPageId = <guid> })

    The view still loads the default template and no exceptions show up, but still no functionality if I click to login.

  2. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    23 Sep 2016
    20 May
    Link to this post
    Hello,

    What you are trying to achieve is not possible because the TemplateName and LoginPageId are properties of the Controller and Model respectively. The PartialView method can only pass route data to the action and cannot access properties of the controller or model.

    You can try rendering the view to string in the controller (http://stackoverflow.com/questions/483091/render-a-view-as-a-string) and displaying it as raw html in the view. This way you will be able to set the properties of the controller as well as create a model and set its properties.

    Please note that in Sitefinity's context you will need to use the SitefinityViewEngine class and call its FindView method instead of calling the FindView method on the ViewEngines collection.

    Please also note that this approach renders only the view and any other necessary scripts will need to be added manually.

    Regards,
    Velizar Bishurov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    20 May in reply to Velizar Bishurov
    Link to this post
    Thanks for the information.  That does make sense, I guess I was hoping I was missing something trivial.  
3 posts, 0 answered