Copied to clipboard

Flag this post as spam?

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


  • Bo Damgaard Mortensen 719 posts 1207 karma points
    May 19, 2012 @ 19:17
    Bo Damgaard Mortensen
    0

    Pre and post text on multinodepicker

    Hi all,

    I'm using the MultiNodePicker to create "relations" between content in Umbraco and the layout/design of the website is as follows:

    "Some text entered by the admin1 MNTP NodeName1 Some text entered by the admin1" 

    "Some text entered by the admin2 MNTP NodeName1 Some text entered by the admin2" 

    "Some text entered by the admin3 MNTP NodeName1 Some text entered by the admin3" 

    So basically the admin should be able to enter som pre-MNTP-text and some post-MNTP-text for each of the nodes picked in the picker.

    I've started creating my own UserControl for this, but since the MNTP is just awesome at what it does, I'm wondering if there's some other, more easy solution to this problem? :-)

    Thanks in advance.

    All the best,

    Bo

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    May 19, 2012 @ 19:19
    Bo Damgaard Mortensen
    0

    The above example should, of course, be:

    "Some text entered by the admin1 MNTP NodeName1 Some text entered by the admin1"

    "Some text entered by the admin2 MNTP NodeName2 Some text entered by the admin2"

    "Some text entered by the admin3 MNTP NodeName3 Some text entered by the admin3"

  • Trevor Loader 199 posts 256 karma points
    May 20, 2012 @ 03:21
    Trevor Loader
    0

    Have you thought about using the DataTypeGrid uComponents package instead?  That way you could define each row to have three fields, pre textstring fiels, content picker, and post textstring field?

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    May 20, 2012 @ 04:22
    Bo Damgaard Mortensen
    0

    Hi Trevor and thanks for your input :-)

    Just had a look at the control and it could be what I'm looking for, it's only that I'm not able to use my own dropdown control (or simply and XPath dropdownlist) as the middle datatype :-( Is there any kind og workaround for this?

    Thanks again.

  • Trevor Loader 199 posts 256 karma points
    May 20, 2012 @ 04:29
    Trevor Loader
    0

    You can use your owndrop down control.  Create a new datatype of type dropdown and populate it.  Copy the guid from the datatype and paste into the DataTypeGrid.config in the /config directory.

    You should then be able to pick the new dropdown as a field in your datatypegrid.

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    May 20, 2012 @ 12:27
    Bo Damgaard Mortensen
    0

    Hi again Trevor and thanks for your help :-)

    I've tried to following dropdowns as the datatype within the grid:

    - uComponents XPath dropdown which throws a nullpointer reference when trying to load the node which have the datatypegrid as a property.

    - Ultimate Picker which doesn't render in the datatypegrid

    - My own UserControl in an Umbraco UserControl wrapper which displays the dropdown with data, but fails to store the chosen data and also not displaying the name of the chosen data in the grid.

    So, any hint on this is greatly appreciated! ;-)

    Thanks again,

    Bo

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    May 20, 2012 @ 14:17
    Bo Damgaard Mortensen
    0

    Alright, so far so good, got it to show/store a value from the dropdown box, but I seem to have some postback issues that I can't get my head around as it always chooses the first item in the list when I click 'Add'

    My usercontrol code looks like this:

    protected void Page_Init(object sender, EventArgs e)
            {
                var ingredients = uQuery.GetNodesByXPath("//SharedContent/Ingredients/IngredientCategory/Ingredient");
                ddIngredients.DataSource = ingredients;
                ddIngredients.DataTextField = "Name";
                ddIngredients.DataValueField = "Id";
                ddIngredients.DataBind();
            }
    
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!Page.IsPostBack)
                {
                    if (!string.IsNullOrEmpty(_umbracoValue))
                    {
                        foreach (ListItem item in ddIngredients.Items)
                        {
                            if (item.Text.Equals(_umbracoValue))
                            {
                                item.Selected = true;
                                break;
                            }
                        }
                    }
                }
            }
    
            private string _umbracoValue;
            public object value
            {
                get
                {
                    return ddIngredients.SelectedItem.Text;                
                }
                set
                {
                    if(value != null && !string.IsNullOrEmpty(value.ToString()))
                    {
                        _umbracoValue = value.ToString();
                    }
                }
            }

    Debugging it, it seems to run the Page_Init event 3 or 4 times when I hit the 'Add' button.

    Anyone got a clue on this? :-)

    Thanks in advance,

    Bo

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    May 22, 2012 @ 17:46
    Bo Damgaard Mortensen
    0

    Still no luck on this :-( I'be come to the conclusion that the client would have to use the standard content picker in the datatype grid, however, this is showing the node ID of the selected node which is not ideal from a "normal" users point of view. Is there any way to get it to show the nodename instead of the id?

    Thanks again!

    - Bo

  • Ove Andersen 435 posts 1541 karma points c-trib
    May 23, 2012 @ 09:22
    Ove Andersen
    0

    Which version of uComponentsare you using?

  • Trevor Loader 199 posts 256 karma points
    May 23, 2012 @ 09:35
    Trevor Loader
    0

    Hi, I'm using the latest.  My suggestion was to use the standard content picker...or you can create a standard dropdown list and populate that.  In either case, you do only see the ID and not the text of the item picked.

  • Ove Andersen 435 posts 1541 karma points c-trib
    May 23, 2012 @ 09:38
    Ove Andersen
    0

    To answer your code sample post above:

    When loading the DTG editor, it creates every component 2 times - one for the edit dialog, one for the add dialog.
    If you add something it needs to re-run those two actions and then save the data to store it the database.

    That's why you can see it running 4 times. 

  • Ove Andersen 435 posts 1541 karma points c-trib
    May 23, 2012 @ 09:39
    Ove Andersen
    0

    Hmm. The standard content picker is supposed to show the name and not the id.

    Could you post a screenshot?

  • Trevor Loader 199 posts 256 karma points
    May 23, 2012 @ 10:37
    Trevor Loader
    0

    Here is a screenshot.  Running 4.7.1.1 and uComponents 3.0.2.  Link To column is a standard content picker....only shows the ID and not the name.

  • Trevor Loader 199 posts 256 karma points
    May 23, 2012 @ 10:39
    Trevor Loader
    0

    Just realised that its not the latest uComponents...will upgrade now to 3.1.0 and see if that fixes it.

  • Trevor Loader 199 posts 256 karma points
    May 23, 2012 @ 10:42
    Trevor Loader
    0

    Nope...still the ID in 3.1.0.27082.  Cheers, T

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    May 23, 2012 @ 10:51
    Bo Damgaard Mortensen
    0

    Hi Ove and Trevor,

    Thanks so much for replying to my post :-)

    I'm also running the latest version of uComponents and it shows the node ID like in Trevors screenshot above. Getting it to show the nodename instead of the ID would solve a truckload of problems here ;-) I'll see if I can have a peek at the code when I get home later.

    Thanks again.

    Bo

  • Ove Andersen 435 posts 1541 karma points c-trib
    May 23, 2012 @ 11:26
    Ove Andersen
    0

    Looks like the node name functionality has disappeared at some point. I am 100% sure it was there earlier... :S

    Anyways, I have made a fix, and it should be released with version 3.1.1 

  • Ove Andersen 435 posts 1541 karma points c-trib
    May 23, 2012 @ 14:45
    Ove Andersen
    2

    Also, version 3.1.1 will feature sorting functionality for the content editor.

    (I just added it :-D)

  • Trevor Loader 199 posts 256 karma points
    May 23, 2012 @ 21:56
    Trevor Loader
    0

    Awesome #h5yr!

Please Sign in or register to post replies

Write your reply to:

Draft