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? :-)
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?
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?
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.
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.
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.
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?
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.
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.
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.
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:
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
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"
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?
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.
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.
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
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:
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
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
Which version of uComponentsare you using?
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.
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.
Hmm. The standard content picker is supposed to show the name and not the id.
Could you post a screenshot?
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.
Just realised that its not the latest uComponents...will upgrade now to 3.1.0 and see if that fixes it.
Nope...still the ID in 3.1.0.27082. Cheers, T
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
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
Also, version 3.1.1 will feature sorting functionality for the content editor.
(I just added it :-D)
Awesome #h5yr!
is working on a reply...