Copied to clipboard

Flag this post as spam?

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


  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Mar 22, 2012 @ 11:22
    Rasmus Fjord
    0

    membertype properties as array/list

    Hey :)

    Im doing a sweet project at the moment and im need of a few wise stones hope you can help.

    I need to get some propeties from the current member.

    The member has a property of datatype multiple textstring(from ucomponents) normally we can access this in razor like

    @foreach (var x in Model.list) 
    {
          @x.InnerText
    }

    This would output like etc.

    111

    222

    But when im in need of a property from the current member i do it like this.

     var someProperty = member.getProperty("memHouseOwned").Value.ToString();

    When i do this i just get a string like this "111 222" so its just put together and that makes it kinda annoyin to work with.

    Can i cast this some how or is there some other way to get properties a more correct way ?

     

     

     

  • Rodion Novoselov 694 posts 859 karma points
    Mar 22, 2012 @ 19:36
    Rodion Novoselov
    0

    Hi. Afaik, uComponent's multiple textstring returns Xml like

    <values>
      <value>111</value>
      <value>222</value>
    </values>

    So, you need to parse and process it somehow (e.g. using DynamicXml or like that) to put it into the format you need.

  • Rasmus Fjord 675 posts 1566 karma points c-trib
    Mar 23, 2012 @ 08:46
    Rasmus Fjord
    0

    yea just as i thought.

    I found a solution luckily for me the things entered will always be 3 chars and it has 2 spaces in between so this worked :

      string[] someProperty = member.getProperty("memHouseOwned").Value.ToString().Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);

    From here i can tryparse them to int and get on with my work :)

    but thx for your time

Please Sign in or register to post replies

Write your reply to:

Draft