This is a migrated thread and some comments may be shown as answers.

[Solved] Bind Grid to Model Property?

0 Answers 148 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Emmanuel
Top achievements
Rank 1
Emmanuel asked on 27 Aug 2010, 06:50 PM
I have a question.

Is it possible to have a Grid bond to a Model Property (that is a List of objects) which, when edited, will only update the actual Model property it was bond to?

I want to have a submit button outside the Grid which when clicked, will send back the whole Model, with the Property bond to the Grid updated if changed by the client.

What I can do currently is Bind a Model Property to a Grid but it is only on the first page load. As soon as the submit button is pressed, the Property is sent back as null.

ex:
<%= Html.Telerik().Grid(Model.Property)
       
.Name("Grid")
       
.Columns(columns =>
       
{
            columns
.Bound(o => o.OrderID).Width(100);
            columns
.Bound(o => o.ContactName).Width(200);
       
})
       
.DataBinding(dataBinding =>
       
{
            dataBinding
.Server().Select("FirstLook", "Grid", new { ajax =
               
ViewData["ajax"] });
            dataBinding
.Ajax().Select("_FirstLook",
               
"Grid").Enabled((bool)ViewData["ajax"]);
       
})
       
.Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
       
.Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
       
.Pageable(paging => paging.Enabled((bool)ViewData["paging"]))
       
.Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
       
.Groupable(grouping => grouping.Enabled((bool)ViewData["grouping"]))
       
.Footer((bool)ViewData["showFooter"])
%>
Tags
Grid
Asked by
Emmanuel
Top achievements
Rank 1
Share this question
or