How can i edit/save with c# a property witch is sql:autocomplete
Hey all, im new to umbraco so i am kinda "lost" :( .
Few weeks ago i started a project with umbraco and c# and now im stuck. I can save and edit any other property values by doing this:
member.getproperty("alias").value= //something
or
member.getproperty("alias").value.ToString() to read it.
but now i need to work with a property witch is autocomplete and i simple cant do nothing with it. Basicly what i get when i do Response.Write(member.getproperty("myList1-Foundations").value.ToString()) to read it and check it, is nothing (that we can see in browser) but if i right click on the mouse and go to view page source i got something like this :
<sqlautocomplete>
<item text="A. P. Møllers Fond for islandske studerende ved de højere Læreanstalter" value="1279">
<item text="Aktive Unge - Ungdomsudvekslinger i nabopartnerlande" value="1358">
</item>
</item>
</sqlautocomplete>
But i cant do nothing with this , at least as far i my umbraco experience goes. What i need to do is basicly when edit add new item to this property . If anyone could help i would appreciate . Thanks guys
Can you tell us, which version of Umbraco you're using? And I'm guessing you're using uComponents since you're referring to the sql autocomplete box as well?
Sql AutoComplete saves its data in an xml fragment as you've described above - to manually add an item you'll need to add an node into that xml fragment, and then resave the whole fragment.
eg (this hasn't been tested !)
using System.Xml.Linq;
XDocument xDocument = XDocument.Parse(member.getproperty("alias").value.ToString());
xDocument.Root.Add(new XElement(
"Item",
new XAttribute("Text", "some text"),
new XAttribute("Value", "some value")));
member.getproperty("alias").value = xDocument.ToString();
What's your use-case, perhaps there's another way without having to manipulate the xml ?
Guys i dont want to "abuse" from your help , but in my case im using this to save list's with favorites but 1 member can have more than 1 list. So when they want to create another list, i need to create a new property to the member? cause in this case im just editing a property i already created "myList1-Foundations" but if the user wants to create(and he have that option) "myList2-Foundations" i have to create dynamicly the property ? how? :S
In the backoffice is something like this :
Thanks for the effort and sorry for my bad english (im from Portugal :D)
How can i edit/save with c# a property witch is sql:autocomplete
Hey all, im new to umbraco so i am kinda "lost" :( .
Few weeks ago i started a project with umbraco and c# and now im stuck. I can save and edit any other property values by doing this:
member.getproperty("alias").value= //something
or
member.getproperty("alias").value.ToString() to read it.
but now i need to work with a property witch is autocomplete and i simple cant do nothing with it. Basicly what i get when i do Response.Write(member.getproperty("myList1-Foundations").value.ToString()) to read it and check it, is nothing (that we can see in browser) but if i right click on the mouse and go to view page source i got something like this :
<sqlautocomplete>
<item text="A. P. Møllers Fond for islandske studerende ved de højere Læreanstalter" value="1279">
<item text="Aktive Unge - Ungdomsudvekslinger i nabopartnerlande" value="1358">
</item>
</item>
</sqlautocomplete>
But i cant do nothing with this , at least as far i my umbraco experience goes. What i need to do is basicly when edit add new item to this property . If anyone could help i would appreciate . Thanks guys
Hi Diogo and welcome to our :)
Can you tell us, which version of Umbraco you're using? And I'm guessing you're using uComponents since you're referring to the sql autocomplete box as well?
/Jan
Hi Diogo,
Sql AutoComplete saves its data in an xml fragment as you've described above - to manually add an item you'll need to add an node into that xml fragment, and then resave the whole fragment.
eg (this hasn't been tested !)
Hey Jan Skovgaard , and thanks for the welcome's :) Im using V6.1
Hendy Racher you are the MAN !
WOW Thankssssssssss ! thankssssssssss ! U cant imagine how many hours i "wasted" in order to get this working :O
So simple as that , really THANK YOU SIR ! :D
Guys i dont want to "abuse" from your help , but in my case im using this to save list's with favorites but 1 member can have more than 1 list. So when they want to create another list, i need to create a new property to the member? cause in this case im just editing a property i already created "myList1-Foundations" but if the user wants to create(and he have that option) "myList2-Foundations" i have to create dynamicly the property ? how? :S
In the backoffice is something like this :
Thanks for the effort and sorry for my bad english (im from Portugal :D)
is working on a reply...