I tried something like that but it still shows ids
List lst = new List(); var members = Member.GetAll;
foreach (Member member in members) { lst.Add(member.getProperty("member_CompanyName").Value.ToString()); var mp = member.getProperty("member_Province").Value.ToString(); foreach(var id in mp.Split(',')) { lst.Add(id); //Response.Write(id); } }
If you know the umbraco id of the datatype you are using to get prevalues from you can use umbraco.library method GetPrevalues(int dataTypeId):
var preValues = umbraco.library.GetPrevalues(1234);
Alternatively for a specific prevalue you can use the GetPreValueAsString(int id) method:
var preValueString = umbraco.library.GetPreValueAsString(1234);
Looking at your above code you could try something like:
foreach(Member member in members) { var preVal = (int)member.getProperty("member_CompanyName").Value;
lst.Add(umbraco.library.GetPreValueAsString(preVal)); }
How to prevalue as string via codebehind?
I try to get the string from prevalue and display text in griedview. How can I do it?
I tried something like that but it still shows ids
If you know the umbraco id of the datatype you are using to get prevalues from you can use umbraco.library method GetPrevalues(int dataTypeId):
Alternatively for a specific prevalue you can use the GetPreValueAsString(int id) method:
Looking at your above code you could try something like:
After trying your suggestion andy, I get
Specified cast is not valid.
Sorry, I think the Value property object that represents the id is a string. Try the following:
is working on a reply...