ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Loading Awesome Grid from mvc view Model
Title:
B
I
{code}
?
I have a screen with a header data and an awesome grid. I am strongly binding a model in the view. Could you please direct me to an example where a grid is populated from one of the ViewModel properties. Example I have a model public class TestVM { public int HeaderProperty1{ get; set; } public string HeaderProperty2 { get; set; } public string HeaderProperty3{ get; set; } public List<AwesomeGridListItemVM> AwesomeGridVMList { get; set; } } in the view @model EnterResultsVM; header property bind awesomegrid data bind (need assistance here)
Save Changes
Cancel
riya
asked at 14 Dec 2023
Answers
B
I
{code}
?
you can json serialize the data and use it in the `DataFunc` js function for the grid like in this demo: https://demo.aspnetawesome.com/GridClientDataDemo @(Html.Awe().Grid("GridClientData") .DataFunc("getGridData") ... <script> var data = @Html.Raw(DemoUtils.Encode(Model.AwesomeGridVMList)); // DemoUtils.Encode uses JsonConvert.SerializeObject in our demo function getGridData(sgp) { var gp = utils.getGridParams(sgp); var list = data; function map(o) { return { Id: o.Id, Prop1: o.Prop1, ... }; }; return utils.gridModelBuilder( { key: "Id", gp: gp, items: list, map:map, }); } </script>
Save Changes
Cancel
Omu
answered at 14 Dec 2023
Thank you! It worked!!
at 14 Dec 2023
riya
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK