For some reason the Htem.Action gets called twice. This creates errors as by partial view controller checks the query string. The first time it runs the query string is present but the second time it is empty.
I add the Partial Macro to the page through the content editor. Both 'use in rich text editor' & 'render in rich text editor' are ticked
Looking in my projects, wherever I have this pattern, the page calling @Html.Action is of type UmbracoViewPage, not PartialViewMacroPage.
I think this is the same thing Dave is saying - if you don't use the Rich Text Editor but just put the @Html.Action call directly into your template, maybe it will work differently? Other than that, I know that my Controller GET actions are doubled if I ever navigate to them directly within Firefox, but I don't think that's related here.
Looking in my projects, wherever I have this pattern, the page calling @Html.Action is of type UmbracoViewPage, not PartialViewMacroPage.
I think this is the same thing Dave is saying - if you don't use the Rich Text Editor but just put the @Html.Action call directly into your template, maybe it will work differently? Other than that, I know that my Controller GET actions are doubled if I ever navigate to them directly within Firefox, but I don't think that's related here.
Umbraco Partial Macro Error - Action called / runs twice
Hi,
I've coded a partial macro which references a partial view form.
eg.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@Html.Action("ChangeMemberPassword","MemberSurface")
For some reason the Htem.Action gets called twice. This creates errors as by partial view controller checks the query string. The first time it runs the query string is present but the second time it is empty.
I add the Partial Macro to the page through the content editor. Both 'use in rich text editor' & 'render in rich text editor' are ticked
eg.
<div class="umb-macro-holder mceNonEditable"><!-- <?UMBRACO_MACRO macroAlias="changeMemberPassword" /> --> <ins>Macro alias: <strong>changeMemberPassword</strong></ins></div>
Can anyone help me on this. It's pretty annoying as its happening on a few Partial Macros which are setup like this.
Thanks
David
If It makes any difference here is my ServiceController
[HttpGet]
[ActionName("ChangeMemberPassword")]
public ActionResult ChangeMemberPasswordGet()
{
var memberId = Request.QueryString["id"] != null ? int.Parse(Request.QueryString["id"].ToString()) : 0;
if(memberId > 0)
{
var model = new ChangeMemberPasswordModel();
var member = UserManager.GetMemberById(memberId);
if(member != null)
{
if (UserManager.IsMemberInAdminRole(model.CurrentMember.Username) || member.Username == model.CurrentMember.Username)
{
model.Member = member;
return PartialView("ChangeMemberPassword", model);
}
else
{
return Redirect("~/access-denied");
}
}
else
{
return Redirect("~/page-not-found");
}
}
else
{
return Redirect("~/page-not-found");
}
}
Do you have the same issue if you call your action directly from your template ?
Dave
Hi David,
Looking in my projects, wherever I have this pattern, the page calling @Html.Action is of type UmbracoViewPage, not PartialViewMacroPage.
I think this is the same thing Dave is saying - if you don't use the Rich Text Editor but just put the @Html.Action call directly into your template, maybe it will work differently? Other than that, I know that my Controller GET actions are doubled if I ever navigate to them directly within Firefox, but I don't think that's related here.
Hi David,
Looking in my projects, wherever I have this pattern, the page calling @Html.Action is of type UmbracoViewPage, not PartialViewMacroPage.
I think this is the same thing Dave is saying - if you don't use the Rich Text Editor but just put the @Html.Action call directly into your template, maybe it will work differently? Other than that, I know that my Controller GET actions are doubled if I ever navigate to them directly within Firefox, but I don't think that's related here.
Hi,
Looking forther into the issue...
I noticed that this issue is happenig on other if not all macro calls with the standard setup. For example..
I have one standard umbraco razor template page calling a standard umbraco macro and the macro gets called twice everytime. Eg...
Simplified Code...
Umbraco Page:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using CMS.Utils
@{
Layout = "SiteDesign.cshtml";
}
<div id="main-content">
@Umbraco.RenderMacro("galleryAlbumsLatest", new { displayCount = 3 })
</div>
Macro Partial View:
@using CMS.pocos;
@using CMS.Utils;
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
*****THIS GETS HIT TWICE******
var displayCount = !string.IsNullOrEmpty(Model.MacroParameters["displayCount"].ToString()) ? int.Parse(Model.MacroParameters["displayCount"].ToString()) : 3;
List<GalleryAlbum> albums = PhotoGalleryManager.GetGalleryAlbumsLatest(displayCount);
}
<div>
*****JUST STANDARD HTML HERE (NOTHING IMPORTNT) ******
</div>
is working on a reply...