You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When configured for local binding, the Grid for {{ site.framework }} will serialize the data as part of its data source and will perform all data operations, such as paging, sorting, filtering, grouping, and aggregating, on the client.
@@ -85,212 +84,4 @@ To configure the Grid for {{ site.framework }} to do local binding:
85
84
86
85
* [Custom Ajax Binding by the Grid HtmlHelper for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/grid/customajaxbinding)
87
86
* [Knowledge Base Section](/knowledge-base)
88
-
* [Server-Side API](/api/grid)
89
-
90
-
{% else %}
91
-
92
-
# Server Binding
93
-
94
-
By default, the Telerik UI Grid for ASP.NET MVC performs server-side requests (`HTTP` and `GET`) when doing paging, sorting, and filtering.
95
-
96
-
## Supported Client-Side Events
97
-
98
-
The Grid supports the following client-side events when it is in server binding mode:
99
-
100
-
- `Change`
101
-
- `ColumnHide`
102
-
- `ColumnMenuInit`
103
-
- `ColumnReorder`
104
-
- `ColumnResize`
105
-
- `ColumnShow`
106
-
- `DetailCollapse`
107
-
- `DetailExpand`
108
-
- `ExcelExport`
109
-
- `FilterMenuInit`
110
-
- `PdfExport`
111
-
- `GroupExpand`—The group object that is associated with group row will be empty in server binding scenario.
112
-
- `GroupCollapse`—The group object that is associated with group row will be empty in server binding scenario.
113
-
114
-
> * The other client-side events, which are related to data-binding and CRUD data operations, will not be raised when the Grid is configured for server binding.
115
-
> * Locked columns are not supported. To support locked columns, use [Ajax binding]({% slug htmlhelpers_grid_aspnetcore_ajaxbinding %}) instead.
116
-
> * Showing or hiding of columns and reordering with the `GroupHeaderColumnTemplate` in server-binding scenarios is not supported. The reason is that in server-binding scenarios the Kendo UI for jQuery DataSource instance does not have groups and aggregates information. Therefore, the templates for the group rows cannot be compiled on the client side. If your project requires such a scenario, use [Ajax binding]({% slug htmlhelpers_grid_aspnetcore_ajaxbinding %}).
117
-
118
-
## Getting Started
119
-
120
-
To bind the Grid to data, set its data source and render the view by using any of the following approaches:
121
-
122
-
* [Bind to the view model](#binding-to-the-view-model)
123
-
* [Bind to items from `ViewData` or `ViewBag`](#using-the-viewdata-or-viewbag-items-binding)
124
-
* [Use the `BindTo` method](#applying-the-bindto-method)
125
-
* [Pass additional data to an action method](#passing-additional-data-to-action-methods)
126
-
127
-
## Binding to the View Model
128
-
129
-
To download the Visual Studio Project, refer to [this GitHub repository](https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/server-binding).
The Grid makes `HTTP GET` requests to the action method which initially renders the view. The Grid page, sort, filter, and group information is passed as query string parameters.
211
-
212
-
For more information on how a typical URL looks like, refer to [this location](http://localhost:4939/?Grid-sort=ProductName-asc&Grid-page=2\). The `Name` of the Grid will be used as a prefix of the query string parameters. In this way, more than one server-bound Grid can coexist in the same view. The prefix can be disabled through the `PrefixUrlParameters` method.
213
-
214
-
<%: Html.Kendo().Grid(Model)
215
-
.Name("Grid")
216
-
.PrefixUrlParameters(false)
217
-
%>
218
-
219
-
## Passing Additional Data to Action Methods
220
-
221
-
The action method which renders the view that contains the Grid may need additional data.
222
-
223
-
```Controller
224
-
public ActionResult Index(string firstName, string lastName)
225
-
{
226
-
var products = new NorthwindDataContext().Products;
1. Create a new ASP.NET MVC 5 application. If you have installed the [Telerik UI for ASP.NET MVC Visual Studio Extensions]({% slug overview_visualstudio_aspnetmvc %}), create a Telerik UI for ASP.NET MVC application. Name the application `KendoGridServerBinding`. If you decided not to use the Telerik UI for ASP.NET MVC Visual Studio Extensions, follow the steps from the [First Steps article]({% slug gettingstarted_aspnetmvc %}) to add Telerik UI for ASP.NET MVC to the application.
244
-
1. Add a new `Entity Framework Data Model`. Right-click the `~/Models` folder in the solution explorer and pick **Add new item**. Choose **Data** > **ADO.NET Entity Data Model** in the **Add New Item** dialog. Name the model `Northwind.edmx` and click **Next**. This starts the **Entity Data Model Wizard**.
245
-
246
-

247
-
248
-
1. Pick the **Generate from database** option and click **Next**. Configure a connection to the Northwind database. Click **Next**.
249
-
250
-

251
-
252
-
1. Choose the **Products** table from the `Which database objects do you want to include in your model?`. Leave all other options as they are set by default. Click **Finish**.
253
-
254
-

255
-
256
-
1. Open **HomeController.cs** and modify the `Index` action method.
257
-
258
-
public ActionResult Index()
259
-
{
260
-
ViewBag.Message = "Welcome to ASP.NET MVC!";
261
-
var northwind = new NorthwindEntities();
262
-
// Get the Products entities and add them to the ViewBag.
263
-
ViewBag.Products = northwind.Products;
264
-
return View();
265
-
}
266
-
267
-
1. Add a Kendo UI Grid to the `Index` view.
268
-
269
-
```Razor
270
-
@(Html.Kendo().Grid((IEnumerable<KendoGridServerBinding.Models.Product>)ViewBag.Products) //Bind the grid to ViewBag.Products
271
-
.Name("grid")
272
-
.Columns(columns =>
273
-
{
274
-
// Create a column bound to the ProductID property.
275
-
columns.Bound(product => product.ProductID);
276
-
// Create a column bound to the ProductName property.
277
-
columns.Bound(product => product.ProductName);
278
-
// Create a column bound to the UnitsInStock property.
279
-
columns.Bound(product => product.UnitsInStock);
280
-
})
281
-
.Pageable() //Enable the paging.
282
-
.Sortable() //Enable the sorting.
283
-
)
284
-
```
285
-
286
-
1. Build and run the application.
287
-
288
-

289
-
290
-
## See Also
291
-
292
-
* [Binding the Grid HtmlHelper for ASP.NET MVC to Data (Demos)](https://demos.telerik.com/aspnet-mvc/grid/local-data-binding)
293
-
* [Ajax Binding by the Grid HtmlHelper for ASP.NET MVC]({% slug htmlhelpers_grid_aspnetcore_ajaxbinding %})
Copy file name to clipboardExpand all lines: docs-aspnet/html-helpers/data-management/grid/binding/overview.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,11 @@ position: 1
11
11
12
12
Depending on the configuration of its [DataSource]({% slug htmlhelpers_datasource_aspnetcore %}), the {{ site.product_short }} Grid provides different types of data binding.
13
13
14
+
*{% if site.core %}
14
15
*[Local data binding]({% slug htmlhelpers_grid_aspnetcore_localbinding %})
Copy file name to clipboardExpand all lines: docs-aspnet/html-helpers/data-management/grid/scaffolding.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,11 @@ To scaffold the Grid HtmlHelper for ASP.NET MVC:
90
90
91
91
From this screen, you can select the Grid events to which you want to attach handlers.
92
92
93
-
> Not all events are supported in the server-binding mode. To see the complete list, refer to [this article]({% slug htmlhelpers_grid_aspnetcore_localbinding %}#supported-client-side-events).
93
+
{% if site.core %}
94
+
> Not all events are supported in the local-binding mode. To see the complete list, refer to [this article]({% slug htmlhelpers_grid_aspnetcore_localbinding %}#supported-client-side-events).
95
+
{% else %}
96
+
> Not all events are supported in the server-binding mode. To see the complete list, refer to [this article]({% slug serverbinding_grid_aspnetmvc %}#supported-client-side-events).
97
+
{% endif %}
94
98
95
99
1. When finished with the Grid configuration, click **Add** at the bottom. The Grid Controller and the corresponding View are now generated.
Copy file name to clipboardExpand all lines: docs-aspnet/html-helpers/data-management/grid/troubleshoot/troubleshooting.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ The causes of this issue are various.
46
46
{% else %}
47
47
When configured for server binding, the Kendo UI Grid for ASP.NET MVC does not fire all client-side events.
48
48
49
-
**Solution** For more information on how to resolve this issue, refer to the [article on server binding of the Grid]({% slug htmlhelpers_grid_aspnetcore_localbinding %}#supported-client-side-events).
49
+
**Solution** For more information on how to resolve this issue, refer to the [article on server binding of the Grid]({% slug serverbinding_grid_aspnetmvc %}#supported-client-side-events).
50
50
51
51
For an Ajax() bound Grid, make sure that the `.ServerOperation(false)` property is disabled.
0 commit comments