Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
i have written this code. It is displying some error.
see i attached template code because i am passing some values, see blow.
see below code
see error
Hi Jhon
Please, do not use images with code - it's hard to help you.
Share code as code, please.
Thanks,
Alex
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{ int bannerNumber = Convert.ToInt32(@Parameter.bannerNum); //var banner1 = Model.Content.Descendants().Where(x => x.DocumentTypeAlias == "Banner"); var banner1 = Umbraco.TypedContent(1313).Children.OrderBy("UpdateDate desc").Skip(bannerNumber).First();
}
@foreach (var banner in banner1) { var link = banner.GetPropertyValue<IPublishedContent>("link"); <div class="bannersRow"> <div class="widthContent"> <div class="innerbanner1"> <div id="mediaBlock"> image </div> <div style="clear:both;"></div> <div id="textBlock"> @{ if (link != null) { <a href="@link.Url" style="color: black"> <h1 class="banner1Title">@banner.GetPropertyValue("title")</h1> <h2 class="banner1Subtitle">@banner.GetPropertyValue("subtitle")</h2> </a> } else { <h1 class="banner1Title">@banner.GetPropertyValue("title")</h1> <h2 class="banner1Subtitle">@banner.GetPropertyValue("subtitle")</h2> } <div style="clear:both;"></div> } Coming Soon <div style="clear:both;"></div> </div> </div> </div> </div>
Hi Jhon,
you can remove the @ in front of the @Parameter object because you are already in a razor section using the @{ ... }.
@
@Parameter
@{ ... }
Hope this helps!
/Michaël
In the template file , i am passing value like that.
@Html.Partial("BannerRow", new { bannerNum = 0 })
yes i removed @ , it is displaying same error
Yes, i removed , it is displying same error
Jhon
Use this code:
int bannerNumber = (int)ViewData["bannerNum"];
and code for rendering partial:
Html.RenderPartial( "~pathToPartial", currentNode, new ViewDataDictionary(this.ViewData) { { "bannerNum", 0 } } );
@{ int bannerNumber = (int)ViewData["bannerNum"];
Html.RenderPartial( "~pathToPartial", currentNode, new ViewDataDictionary(this.ViewData) { { "bannerNum", 0 } } ); //var banner1 = Model.Content.Descendants().Where(x => x.DocumentTypeAlias == "Banner"); var banner1 = Umbraco.TypedContent(1313).Children.OrderBy("UpdateDate desc").Skip(bannerNumber).First();
See error:
Can you please help me.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Error code
Hi
i have written this code. It is displying some error.
see i attached template code because i am passing some values, see blow.
see below code
see error
Hi Jhon
Please, do not use images with code - it's hard to help you.
Share code as code, please.
Thanks,
Alex
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{ int bannerNumber = Convert.ToInt32(@Parameter.bannerNum); //var banner1 = Model.Content.Descendants().Where(x => x.DocumentTypeAlias == "Banner"); var banner1 = Umbraco.TypedContent(1313).Children.OrderBy("UpdateDate desc").Skip(bannerNumber).First();
}
}
Hi Jhon,
you can remove the
@
in front of the@Parameter
object because you are already in a razor section using the@{ ... }
.Hope this helps!
/Michaël
In the template file , i am passing value like that.
@Html.Partial("BannerRow", new { bannerNum = 0 })
yes i removed @ , it is displaying same error
Yes, i removed , it is displying same error
Jhon
Use this code:
and code for rendering partial:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{ int bannerNumber = (int)ViewData["bannerNum"];
}
}
See error:
Can you please help me.
is working on a reply...