none
Two different objects in a list object - can't find a way to render it.

    Question

  • Hey,

    i have a list object called "cvProperties" to this List i add in turns one object of a ProfileSubtypeProperty and a object of UserProfile property. See Code below.

    for (int i = index; i < allProps.Count; i++)
                    {
                        var prop = (ProfileSubtypeProperty)allProps[i];
                        // If property is section break
                        if (prop.IsSection) break;
                        sectionProperties.Add(prop);
                        tempProperty = prop.Name;                    
                        
                        if (profile[tempProperty].Value != null)
                        {
                            propertyData = profile[tempProperty];
                        }
                        else
                        {
                            propertyData = String.Empty;
                        }
    
                        sectionProperties.Add(propertyData);
    

    Now i want to render the content of my List object into my aspx-Site but i'm kind of stucked there since i dont know how to find and handle the right control.

    Since i want different markup for each type (ProfileSubtypeProperty should be bold) i also need a way to differentiate between these two objects..

     

    Wednesday, October 05, 2011 1:19 PM

Answers

  • You can use a HashTable or dictionary collecitons instead of a List to store of props objects... in that case you can store a key with the value ... like when storing data in the collection.. for labels you can add mapping saying LabelHeader... in that case when you are retrieving the values you can put bold based on this mapped kep for each value whether its a header or not ...

     

    Hope this gives you some ideas....


    "T" | My blog updates | My Twitter | Our Products | Mail Me
    • Marked as answer by Petewhore Thursday, October 06, 2011 11:46 AM
    Thursday, October 06, 2011 6:34 AM

All replies

  • If will be good if you can share more about problem you trying to solve 


    Regards,
    Milan Chauhan
    Wednesday, October 05, 2011 1:34 PM
  • This is the way it should look like in final.

    The changes which i want to apply to my current module is:

    My WebPart is reading the whole section of custom created profile properties. Because i don't want to change my whole webpart if properties are changed or added i want to read the DisplayName from the custom Property (object is called ProfileSubtypeProperty) and the Value which i can access via UserProfile Property.

    Right now my WebPart stores both Informations in one List object. Starting with the DisplayName and the next entry for my list is my property value.

    So it looks like this:

    [0]ObjectwithDisplayName

    [1]ObjectwithPropertyValue

    [2]ObjectwithDisplayName

    [3]ObjectwithPropertyValue

    and so on till section is finished.

    Since i have two different Objects i also want to apply different markup depending on the object.. but i dont know with which control :)

    Wednesday, October 05, 2011 2:01 PM
  • You can use a HashTable or dictionary collecitons instead of a List to store of props objects... in that case you can store a key with the value ... like when storing data in the collection.. for labels you can add mapping saying LabelHeader... in that case when you are retrieving the values you can put bold based on this mapped kep for each value whether its a header or not ...

     

    Hope this gives you some ideas....


    "T" | My blog updates | My Twitter | Our Products | Mail Me
    • Marked as answer by Petewhore Thursday, October 06, 2011 11:46 AM
    Thursday, October 06, 2011 6:34 AM
  • The Idea of the Dictionary worked really fine for me! Thanks!
    Thursday, October 06, 2011 11:46 AM