Copied to clipboard

Flag this post as spam?

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


  • shufflemoomin 37 posts 36 karma points
    Jul 08, 2009 @ 15:13
    shufflemoomin
    0

    Go to node ID selected in dropdown?

    I have a C# user control for use in Umbraco 4. The dropdown list contains a list of nodeIDs. I want Umbraco to load the ID I select in the list. Does anyone know the API call to get umbraco to do this?

    Thanks in advance for any help you can offer.

    Shufflemoomin

  • Nico Lubbers 151 posts 175 karma points
    Jul 08, 2009 @ 15:19
    Nico Lubbers
    0

    using umbraco.presentation.nodeFactory;

     

    Node myNode = new umbraco.presentation.nodeFactory.Node(rootNodeID);

    // now do something with the node

  • shufflemoomin 37 posts 36 karma points
    Jul 08, 2009 @ 21:31
    shufflemoomin
    0

    Thanks for reply, but I really don't understand it. Isn't this line of code just creating a new node item? I just want to send the website to the page selected in a dropdown list. Just like clicking a link, but selectingi it from a dropdown list instead.

     

  • Kenneth Solberg 227 posts 418 karma points
    Jul 08, 2009 @ 21:40
    Kenneth Solberg
    1

    How about redirecting to the selected node in the onChange event of the DropDownList, like this:

    protected void myDropDownList_SelectedIndexChanged(object sender, EventArgs e)
    {
    int nodeId;

    if(Int32.TryParse(myDropDownList.SelectedValue, out nodeId))
    {
    Response.Redirect(umbraco.library.NiceUrl(nodeId), false);
    }
    }
  • shufflemoomin 37 posts 36 karma points
    Jul 09, 2009 @ 10:48
    shufflemoomin
    0

    Thanks Kenneth. Such a simple solution and worked a treat. Just what I needed.

    Still learning I guess. :)

  • Robin Hansen 135 posts 368 karma points
    Oct 19, 2012 @ 14:45
    Robin Hansen
    0
    I have a C# user control for use in Umbraco 4. The dropdown list contains a list of nodeIDs

    Could you plz post a sample of that usercontrol... - I'm struggeling with building exactly such a control: http://our.umbraco.org/forum/developers/extending-umbraco/35452-Display-mediaFolderIds-in-a-usercontrol

    :-)

Please Sign in or register to post replies

Write your reply to:

Draft