Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 3958 posts 8005 karma points admin mvp c-trib
    May 21, 2014 @ 11:39
    Ismail Mayat
    0

    Datatype grid and Ipublisehed content

    Guys,

    What is the best way of working with retrieving data from datatype grid property and Ipublished content, I have so far:

    var questionsRaw = page.GetPropertyValue<string>(questionField);
    
                // Get original data
                var data = new GridRowCollection(questionsRaw);

    Where page is IPublishedContent or is there a propertyvalue convertor?

    Regards

    Ismail

  • Ismail Mayat 3958 posts 8005 karma points admin mvp c-trib
    May 22, 2014 @ 16:04
    Ismail Mayat
    100

    So in answer to my own question

                var rows = page.GetPropertyValue<GridRowCollection>(questionField);
    
                var questions=new List<GoldenQuestion>();
    
                foreach (var row in rows)
                {
    
                    var question = new GoldenQuestion
                    {
                        ControlType = row.GetCell("controlType").GetPropertyValue<string>(),
                        Question = row.GetCell("question").GetPropertyValue<string>(),
                        Answers = row.GetCell("answers").GetPropertyValue<string>().Replace(Environment.NewLine, string.Empty).Replace("\n","").Split('|').ToList() //use the trim to get rid of \r\n
                    };
    
                    questions.Add(question);
                }
    
                return questions;

     

    Regards

     

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft