|
| 1 | +--- |
| 2 | +title: How to handle the empty popup footer when using the Popup Form Template |
| 3 | +description: Learn how to either hide the empty footer in the edit popup of the Grid for Blazor or use it to display custom Form buttons. |
| 4 | +type: how-to |
| 5 | +page_title: How to handle the empty popup footer when using the Popup Form Template |
| 6 | +slug: grid-kb-handle-empty-popup-footer |
| 7 | +tags: grid, blazor, edit form, popup form template, footer, custom buttons, empty |
| 8 | +res_type: kb |
| 9 | +ticketid: 1665785 |
| 10 | +--- |
| 11 | + |
| 12 | +## Environment |
| 13 | + |
| 14 | +<table> |
| 15 | + <tbody> |
| 16 | + <tr> |
| 17 | + <td>Product</td> |
| 18 | + <td>Grid for Blazor</td> |
| 19 | + </tr> |
| 20 | + </tbody> |
| 21 | +</table> |
| 22 | + |
| 23 | +## Description |
| 24 | + |
| 25 | +When using the Popup Form Template in the Grid for Blazor, the footer remains empty, creating unnecessary space and affecting the UI's aesthetics. The requirement is to either hide this empty footer or utilize it by placing custom form buttons within. This KB article also answers the following questions: |
| 26 | +- How to hide the empty footer in the Popup Form Template of the Grid for Blazor? |
| 27 | +- How to display custom buttons in the footer of the Popup Form Template? |
| 28 | +- How to manage form submission with custom buttons in the Grid for Blazor? |
| 29 | + |
| 30 | +## Solution |
| 31 | + |
| 32 | +There are two approaches to address this requirement with the [Grid](https://docs.telerik.com/blazor-ui/components/grid/editing/popup) component for Blazor: |
| 33 | + |
| 34 | +### Option 1: Display Custom Buttons in the Footer |
| 35 | + |
| 36 | +To display custom buttons in the footer and handle form submission, follow these steps: |
| 37 | + |
| 38 | +1. Keep the `<FormButtons>` tag inside the custom Form empty to prevent it from rendering its default buttons. |
| 39 | +2. Declare custom buttons in the `<ButtonsTemplate>` and manage their `OnClick` events for form submission. |
| 40 | + |
| 41 | +Here is an example demonstrating this approach: |
| 42 | + |
| 43 | +```razor |
| 44 | +<Grid> |
| 45 | + ... |
| 46 | + <GridEditForm Popup="true"> |
| 47 | + <PopupFormTemplate> |
| 48 | + ... |
| 49 | + <FormButtons></FormButtons> |
| 50 | + </PopupFormTemplate> |
| 51 | + <ButtonsTemplate> |
| 52 | + <!-- Declare custom buttons here --> |
| 53 | + </ButtonsTemplate> |
| 54 | + </GridEditForm> |
| 55 | +</Grid> |
| 56 | +``` |
| 57 | +[View Sample in Telerik REPL](https://blazorrepl.telerik.com/cIuNHkbv33TPbOw234) |
| 58 | + |
| 59 | +### Option 2: Remove the Footer and Keep Buttons in the FormTemplate |
| 60 | + |
| 61 | +To remove the footer while keeping the buttons within the `<FormTemplate>`, use CSS to hide the empty footer. |
| 62 | + |
| 63 | +Here is an example demonstrating how to hide the footer: |
| 64 | + |
| 65 | +```css |
| 66 | +/* Add this CSS to hide the empty footer */ |
| 67 | +.your-custom-class .k-popup-footer { |
| 68 | + display: none; |
| 69 | +} |
| 70 | +``` |
| 71 | +[View Sample in Telerik REPL](https://blazorrepl.telerik.com/GIEXdYkj2896rYiO43) |
| 72 | + |
| 73 | +## See Also |
| 74 | + |
| 75 | +- [Grid Editing - Popup Mode Documentation](https://docs.telerik.com/blazor-ui/components/grid/editing/popup) |
| 76 | +- [Customizing the Grid's Edit Form](https://docs.telerik.com/blazor-ui/knowledge-base/grid-custom-edit-form) |
0 commit comments