Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Aug 25, 2010 @ 12:09
    Ismail Mayat
    0

    macro container issue with .net macro

    I have .net macro that renders a drop down the source of the dropdown is list of nodes from a given page the list is built usng linq2umbraco.  When i add a macro on to template or page all works fine. however when i try to add the macro via macro container i get empty list. Also the empty validation message appears looks like its posting back?

    Any ideas does macro container work with .net macros?

    Regards

    Ismaill

  • Comment author was deleted

    Aug 25, 2010 @ 12:59

    Type of macro shouldn't mather, are you using any custom macro paramater types?

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Aug 25, 2010 @ 13:03
    Ismail Mayat
    0

    Tim,

    The macro has 2 properties both content pickers.

    Cheers

    Ismail

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Aug 25, 2010 @ 13:20
    Morten Christensen
    0

    Hi Ismail,

    I have you tried debugging the .NET Macro to see if it gets the two properties and goes on to load up the nodes correctly, as well as where in the page load you hit when using the macro container?

    And do you have a if(!IsPostBack) in there somewhere :)

    Maybe a sample of your macro code might help resolve your issue.

    - Morten

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Aug 25, 2010 @ 13:33
    Ismail Mayat
    0

    Morten,

    I did have !IsPostBack i took that out but that still didnt work the in the macro code looks like:

            readonly WoiDataContext _woiContext = new WoiDataContext();
    public int CountryStartNode { get; set; }
    public int ProductSearchPageId { get; set; }
    protected void Page_Load(object sender, EventArgs e)
    {
    if(!IsPostBack){
    FillDropDown();
    }
    }

    private void FillDropDown()
    {
    var countries = _woiContext.Countrys.Where(x => x.ParentNodeId == CountryStartNode);
    DdlDestination.DataSource = countries;
    DdlDestination.DataValueField = "Name";
    DdlDestination.DataTextField = "Name";
    DdlDestination.DataBind();
    }

    protected void viewDestination_Click(object sender, EventArgs e)
    {
    if(ProductSearchPageId!=0 && DdlDestination.SelectedValue!=string.Empty)
    {
    string productSearchUrl = umbraco.library.NiceUrl(ProductSearchPageId);
    Response.Redirect(productSearchUrl + "?country=" + DdlDestination.SelectedValue);
    }
    }

    Regards

     

    Ismail

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Aug 25, 2010 @ 13:44
    Morten Christensen
    0

    Hmm, yeah this looks pretty straight forward - if there actually is a match on ParentNodeId and CountryStartNode :)

    Is the DataContext actually initialized? That would be my best bet if you said the list is empty and there is a match on ParentNodeId == CountryStartNode.

    - Morten

Please Sign in or register to post replies

Write your reply to:

Draft