Copied to clipboard

Flag this post as spam?

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


  • riya mahanty 11 posts 81 karma points
    Jan 14, 2016 @ 10:38
    riya mahanty
    0

    Error loding Partial View script

    Error loading Partial View script (file: ~/Views/MacroPartials/FeaturedProductDetails.cshtml) How to solve it

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 14, 2016 @ 10:58
    Dennis Aaen
    0

    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

  • riya mahanty 11 posts 81 karma points
    Jan 14, 2016 @ 11:21
    riya mahanty
    0

    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

    @Umbraco.RenderMacro("ProductDetailsPage")

    and this the main page where i call the macro -

    Featured Products

    @Umbraco.RenderMacro("FeaturedProductDetails")
  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 14, 2016 @ 11:31
    Dennis Aaen
    0

    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.

    @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.

    Hope this helps,

    /Dennis

  • riya mahanty 11 posts 81 karma points
    Jan 14, 2016 @ 11:55
    riya mahanty
    0

    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.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Jan 14, 2016 @ 12:44
    Dennis Aaen
    0

    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 (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.

    Hope this helps,

    /Dennis

  • riya mahanty 11 posts 81 karma points
    Jan 14, 2016 @ 13:14
    riya mahanty
    0

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft