Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am trying to create an extra texstring in the new datatype repeatable texstring. Is that at all possible??
I have a property with the alias "test", wich a repeatable textstring. In this example i want to save emails programmatically to the array of textstrings.
I am going for 1 textstring per email. So that you can access the emails from umbraco admin.
I have the following code at the moment
var contentService = ApplicationContext.Services.ContentService;
IPublishedContent root = Umbraco.TypedContentAtRoot().First();
var newsletter = root.Descendant("boletinInformativo");
//Test is the alias for repeatable textstring
var mailsInNewsletter = newsletter.GetPropertyValue<string>("test");
var getNewsletter = contentService.GetById(newsletter.Id);
// This is where i am quite lost i have email as a parameter in the actionresult that i want to assign
getNewsletter.SetValue("test", mailsInNewsletter + ??? );
return Json("yes", JsonRequestBehavior.AllowGet);
I hope you have an idea of what i am trying to achieve.
Mathias, were you ever able to solve this issue? We are running into the exact same issues and cannot find a solution either.
Found the solution -- for repeatable strings (and I would imagine any type of list), you need to segment the different line items by (ironically enough) a new line. Code is as follows:
content.SetValue(propertyName, "item1" + Environment.NewLine + "item2");
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted