Copied to clipboard

Flag this post as spam?

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


  • Jacob 39 posts 88 karma points
    Nov 15, 2010 @ 12:38
    Jacob
    0

    Find macro/usercontrol and redirect to it.

    Hello

    I am new to Umbraco and I do not know if im posting this in the right section.

    Im trying to port some of my existing code to Umbraco and im looking for a way to jump from 1 "macro/usercontrol" to another.

    I think I should provide an example to help explain what I wanna do.

    Lets use a webshop as an example. Lets say Im standing in the main basket view (a macro/usercontrol) and wanna jump to the order view (a seperat macro/usercontrol) lets call the macro orderView how would I do this?

    Can I do somthing like Response.Redirect(Find("orderView")) with the Umbraco API where it find the orderView macro, and can I pass parameters with the call like a GUID maybe?

    I hope you understand what I mean.

     

  • Eduardo 106 posts 130 karma points
    Nov 15, 2010 @ 12:41
    Eduardo
    0

    Hi Jacob,

    Why don't you place each macro in a different page? So you can use Response.Redirect().

    Hopes this helps.

    Sincere regards,
    Eduardo Macho

  • Jacob 39 posts 88 karma points
    Nov 15, 2010 @ 13:26
    Jacob
    0

    Hi

    I do see your point, and I could do this, but I wanna be able to use this on alot of sites, and this would mean the pages had to be created everytime and the macro added to it. I was hoping I could make it so the system itself could find created macros. Kinda so I could make a macro creater which made the needed macros for a shop and it would work without having to create pages and and macros to em, if you see what I mean.

    Btw, if you wanna transfer info like a GUID in umbraco do you then use querystring parameters, or can you do somthing like www.mysite.dk/item;123 and retrieve 123 somehow?

  • Eduardo 106 posts 130 karma points
    Nov 18, 2010 @ 07:18
    Eduardo
    0

    Hi Jacob,

    My Idea:

    1. Get QueryString parameter 

    for example: www.mysite.dk/item?item_ID=control22

     <% if ( !string.IsNullOrEmpty(Request.QueryString["item_ID"]) )
     
    {


      %>
        <umbraco:Macro Alias="control22" runat="server"></umbraco:Macro>
        <%
      }
      else
      {
        %>
        <umbraco:Macro Alias="defaultControl" runat="server"></umbraco:Macro>
        <%
      }
      %>

    HTH

    Sincere regards,
    Eduardo

  • Jacob 39 posts 88 karma points
    Nov 18, 2010 @ 12:35
    Jacob
    0

    Hey

    I figured out it was probably better to use a template, then add the macro to the template and find the template, so started this thread:

    http://our.umbraco.org/forum/developers/api-questions/14685-Find-node-from-template-alias

     

Please Sign in or register to post replies

Write your reply to:

Draft