|
1 | 1 | <!-- default badges list -->
|
2 |
| - |
3 | 2 | [](https://supportcenter.devexpress.com/ticket/details/T102593)
|
4 | 3 | [](https://docs.devexpress.com/GeneralInformation/403183)
|
5 | 4 | <!-- default badges end -->
|
6 |
| -<!-- default file list --> |
7 |
| -*Files to look at*: |
8 | 5 |
|
9 |
| -* [HomeController.cs](./CS/Q588216/Controllers/HomeController.cs) (VB: [HomeController.vb](./VB/Q588216/Controllers/HomeController.vb)) |
10 |
| -* [MyModel.cs](./CS/Q588216/Models/MyModel.cs) (VB: [MyModel.vb](./VB/Q588216/Models/MyModel.vb)) |
11 |
| -* **[_GridViewPartial.cshtml](./CS/Q588216/Views/Home/_GridViewPartial.cshtml)** |
12 |
| -* [Index.cshtml](./CS/Q588216/Views/Home/Index.cshtml) |
13 |
| -* [_Layout.cshtml](./CS/Q588216/Views/Shared/_Layout.cshtml) |
14 |
| -<!-- default file list end --> |
15 |
| -# A simple implementation of FormLayout inside EditFormTemplate |
| 6 | +# Grid View for ASP.NET Web Forms - How to define FormLayout inside edit form template |
16 | 7 | <!-- run online -->
|
17 | 8 | **[[Run Online]](https://codecentral.devexpress.com/t102593/)**
|
18 | 9 | <!-- run online end -->
|
19 | 10 |
|
| 11 | +This example demonstrates how to use the [SetEditFormTemplateContent](https://docs.devexpress.com/AspNetMvc/DevExpress.Web.Mvc.GridViewSettings.SetEditFormTemplateContent(System.Action-DevExpress.Web.GridViewEditFormTemplateContainer-)) method to define the [FormLayout](https://docs.devexpress.com/AspNetMvc/16028/components/site-navigation-and-layout/formlayout) extension in edit form template. |
20 | 12 |
|
21 |
| -<p>This example demonstrates how to define the FormLayout extension within EditFormTemplate using the SetEditFormTemplateContent method.<br /><br />See the <a href="https://www.devexpress.com/Support/Center/p/T163285">GridView - EditFormTemplate with strong-typed FormLayout</a> example for how to achieve this functionality with using a strong-typed FormLayout.</p> |
| 13 | + |
22 | 14 |
|
23 |
| -<br/> |
| 15 | +```csharp |
| 16 | +settings.SetEditFormTemplateContent(c => { |
| 17 | + var editItem = ViewData["Item"] != null ? ViewData["Item"] : c.DataItem; |
| 18 | + Html.DevExpress().FormLayout(set => { |
| 19 | + set.Name = "FormLayout"; |
| 20 | + // ... |
| 21 | + }).Render(); |
| 22 | + // ... |
| 23 | +}); |
| 24 | +``` |
24 | 25 |
|
| 26 | +## Files to Review |
25 | 27 |
|
| 28 | +* [_GridViewPartial.cshtml](./CS/Q588216/Views/Home/_GridViewPartial.cshtml) |
| 29 | +* [HomeController.cs](./CS/Q588216/Controllers/HomeController.cs) (VB: [HomeController.vb](./VB/Q588216/Controllers/HomeController.vb)) |
0 commit comments