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 4511 posts 10092 karma points MVP 2x admin 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 4511 posts 10092 karma points MVP 2x admin 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

  • Echo Train 16 posts 106 karma points
    Mar 15, 2018 @ 18:05
    Echo Train
    0

    Is there a using directive or reference for GridRowCollection? I can't get this to work.

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft