If it´s possible for you show the code of this file, then I think it would be easier to help you solve the issue, or guide your in the right direction.
This is my Partial view macro file code-
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{ var selection = CurrentPage.Children.Where("Visible").OrderBy("CreateDate desc"); }
@* OrderBy() takes the property to sort by and optionally order desc/asc *@
Try to use this, something when wrong when you pasted in the code. A pro tip when you are adding code snippet to your posts, click on the two {} when you have marked the piece of code.
But now back to your questions if it´s a text string then you can do something like this.
@foreach (var item in selection) {
@item.productDetailspg
@item.pricepg
}
If you are using other data types, please let me know and I will help you further.
thanks for help
But problem is i have a page where i show some image with details
is it possible .
I mean to say upload only form one page with a single upload control and single textstring control.
You could use the media picker, to let the user choose a item from the media library, if you want to do it this way you could use the code snippet below to render out the image.
if (CurrentPage.HasValue("mainImage")){
var dynamicMediaItem = Umbraco.Media(CurrentPage.mainImage);
<img src="@dynamicMediaItem.umbracoFile" alt="@dynamicMediaItem.Name"/>
}
If you are in the foreach loop then remember to change the CurrentPage to item or what variable your a using. Also remember to change the alias so it match your property alias for the media picker. In the example the property alias is "mainImage"
You also have the option to use the upload data type, with this you let the user upload a picture from their computer to use on the page. If you are using this approach then you can use the code snippet below.
if (CurrentPage.HasValue("umbracoFile")){
<img src="@CurrentPage.umbracoFile" />
}
And again remember to change the alias and stuff so it match your case.
Error loding Partial View script
Error loading Partial View script (file: ~/Views/MacroPartials/FeaturedProductDetails.cshtml) How to solve it
Hi Riya,
If it´s possible for you show the code of this file, then I think it would be easier to help you solve the issue, or guide your in the right direction.
/Dennis
This is my Partial view macro file code- @inherits Umbraco.Web.Macros.PartialViewMacroPage
@{ var selection = CurrentPage.Children.Where("Visible").OrderBy("CreateDate desc"); } @* OrderBy() takes the property to sort by and optionally order desc/asc *@
@foreach (var item in selection) {
@Umbraco.Field("productDetailspg")
£@Umbraco.Field("pricepg")
}
this is my child page template-
Featured Products
and this the main page where i call the macro -
Featured Products
@Umbraco.RenderMacro("FeaturedProductDetails")Hi Riya,
Try to use this, something when wrong when you pasted in the code. A pro tip when you are adding code snippet to your posts, click on the two {} when you have marked the piece of code.
But now back to your questions if it´s a text string then you can do something like this.
If you are using other data types, please let me know and I will help you further.
Hope this helps,
/Dennis
thanks for help But problem is i have a page where i show some image with details is it possible . I mean to say upload only form one page with a single upload control and single textstring control.
Hi Riya,
You could use the media picker, to let the user choose a item from the media library, if you want to do it this way you could use the code snippet below to render out the image.
If you are in the foreach loop then remember to change the CurrentPage to item or what variable your a using. Also remember to change the alias so it match your property alias for the media picker. In the example the property alias is "mainImage"
You also have the option to use the upload data type, with this you let the user upload a picture from their computer to use on the page. If you are using this approach then you can use the code snippet below.
And again remember to change the alias and stuff so it match your case.
Hope this helps,
/Dennis
Thanks
is working on a reply...