Copied to clipboard

Flag this post as spam?

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


  • Umbraco Newbie 22 posts 124 karma points
    Aug 27, 2017 @ 10:43
    Umbraco Newbie
    0

    Get data from Skybrud.Umbraco.GridData in controller

    Hi

    I'm using GridData for the layout in the backoffice, but I do not want to @Html.GetGridHtml to display the HTML in the UI, I want to use a strong viewmodel.

    I have getting so far with my code, but I cannot get the values from the json in my controller.

    Can any help, my code is below.

    foreach (GridSection section in grid.Sections)
                {
                    foreach (GridRow row in section.Rows)
                    {
                        foreach (GridArea area in row.Areas)
                        {
                            foreach (GridControl control in area.Controls)
                            {
                                switch (control.Editor.Alias.ToLower())
                                {
                                    case "headlineh1":
    
                                        bool hi = control.JObject.First.HasValues;
                                        if (hi)
                                        {
                                            //Need to get value for headline1 here
                                            //JToken test = control.JObject.Value<string>();
                                            //var test = JsonConvert.DeserializeObject(control.JObject.ToString());
                                            //string test1 = 
                                        }
                                        break;
                                }
    
                            }
                        }
                    }
                } 
    
Please Sign in or register to post replies

Write your reply to:

Draft