Open Closed

Suite Save & generate truncates customized MVC CreateModal/EditModal templates after property fields — footer and closing tags missing. #10807


User avatar
0
abpdevPro created

Description :- We customized the Suite MVC templates for :-

  1. Frontend.Mvc.Page.CreateModal.cshtml.txt
  2. Frontend.Mvc.Page.EditModal.cshtml.txt The customized templates are complete in the Suite Templates UI (including footer actions and closing tags for the form / panel markup). After Save and generate for a new entity, the generated files :-
  • Pages/.../CreateModal.cshtml
  • Pages/.../EditModal.cshtml are only partially written.

Observed behavior :-

  1. Generation writes the page header, opening form tag, panel/body chrome, and the injected property inputs (from the main entity tab placeholder).
  2. Generation then stops.
  3. Everything after the property fields is missing: footer actions, closing panel tags, and the closing form tag.
  4. This causes Razor build errors such as malformed form tag helper (start tag without end tag).
  5. Sometimes markup near the top of the generated modal is also corrupted (e.g. a tag’s opening portion is dropped and only attributes remain).

Expected behavior :- Suite should emit the full customized template after placeholder replacement, including all content after the property-injection placeholder (footer and closing tags).

Important notes :-

  • The customized template content in Suite is complete before generate; the footer is not missing from the template itself.
  • Default (non-customized) Create/Edit templates generate correctly for us.
  • The problem appears when Create/Edit templates are customized away from the default abp-modal structure (we use a custom off-canvas-style layout with Suite placeholders and suite-custom-code-block-* markers).
  • Removing Suite fingerprint/hash lines (##...##) from the template does not fix truncation.
  • Reproducible across entities and modules when the same customized Create/Edit templates are used.
  • Backend generation (entity, app service, etc.) generally succeeds; this is specifically the MVC Create/Edit cshtml output.

Steps to reproduce :-

  1. Open ABP Suite for an MVC module solution.
  2. Customize Frontend.Mvc.Page.CreateModal.cshtml.txt and Frontend.Mvc.Page.EditModal.cshtml.txt (replace default modal chrome with a custom panel layout; keep Suite placeholders such as the main entity tab placeholder and custom-code-block markers).
  3. Create a new entity with a few properties (string/bool/enum is enough).
  4. Enable UI generation and click Save and generate.
  5. Open the generated CreateModal.cshtml / EditModal.cshtml.

Result :- Files end after the last generated property input; footer and closing tags are absent; project fails to build.

Workaround :- After every generate, manually append the missing footer and closing tags to Create/Edit cshtml files.

Questions for support :-

  1. Is this a known issue with customized CreateModal/EditModal templates when the structure differs from default abp-modal?
  2. Is there a supported template pattern (marker order / placeholders / custom-code blocks) that guarantees content after the main entity tab placeholder is always written?
  3. Can Suite validate that generated Create/Edit cshtml still contains a closing form tag and fail the generate step loudly if not?
  4. Is there a recommended way to customize Create/Edit UI (off-canvas/panel) without hitting this truncation?

Environment :-

  • ABP / Suite: 10.5.0
  • Target framework: .NET 10
  • UI: MVC
  • OS: Windows 11
  • Happens on multiple developer machines with the same customized templates.
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    This is a limitation of how Suite processes the Create/Edit modal templates. Besides placeholder replacement, it runs two extra steps during generation that assume the default template structure, and a customized layout can lose content to them:

    1. When the entity's "Preserve custom code" option is not enabled, Suite removes each @*//<suite-custom-code-block-N>*@ ... @*//</suite-custom-code-block-N>*@ pair together with everything between the markers. In the default template these blocks are empty, so you never notice. If your footer and closing tags are inside a marker pair, they are removed on every generate — that's exactly the truncation you're seeing.

    2. When the entity has no navigation connections, Suite removes every line that starts with <abp-tab or </abp-tab (leading whitespace is ignored, so indentation doesn't matter). This is line-based, so a multi-line <abp-tab ...> opening tag leaves an orphan line with only the attributes (the corrupted markup near the top), and anything that follows </abp-tab> on the same line is removed together with it.

    Suite doesn't validate the generated markup at the moment, so a missing closing form tag doesn't fail the generate step — the file is written as-is.

    So for a custom off-canvas/panel layout:

    • Keep static markup (footer actions, closing panel tags, the closing form tag) outside the suite-custom-code-block markers. Content inside the markers is only preserved when "Preserve custom code" is enabled for the entity.
    • Use each suite-custom-code-block-N index only once per file.
    • Put <abp-tabs>, <abp-tab ...>, </abp-tab> and </abp-tabs> each on their own line, keep the opening tag on a single line, and don't put other markup on those lines.
    • Keep the ##...## line in the files under .suite/customized-suite-templates — Suite strips the first line of those files when loading, so if you delete the hash header, the first real template line is lost instead.

    After updating the two templates this way, save them and regenerate — the off-canvas layout keeps everything after the property fields, including the footer and closing tags.

    If it still truncates after these changes, share your customized CreateModal/EditModal .cshtml.txt files and we can point out the exact line that triggers it.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    abpdevPro created

    Hi maliming,

    Thanks for the explanation. We applied your guidance and regenerated — the truncation is still happening.

    What we changed On both customized templates (Frontend.Mvc.Page.CreateModal.cshtml.txt and Frontend.Mvc.Page.EditModal.cshtml.txt):

    1. Moved footer actions, closing panel tags, and closing form tag outside the suite-custom-code-block-* markers.
    2. Left blocks 2 / 3 / 4 as empty pairs (same pattern as the default modal template).
    3. Kept each custom-code-block index used only once.
    4. Kept the ##...## hash line on the disk files under .suite/customized-templates.
    5. Confirmed the Suite Templates UI for this solution shows the updated content (footer after the empty markers, not inside them).

    Relevant tail of CreateModal template after the placeholders:

    What still happens after Save and generate Generated CreateModal.cshtml / EditModal.cshtml still stop immediately after the last property opening abp-input tag. Missing from the output:

    • empty suite-custom-code-block-2/3/4 markers
    • opening ta-offcanvas-body tag
    • footer
    • closing ta-offcanvas tag / closing form tag So this is not only “content inside custom-code blocks being stripped.” Even content after empty marker pairs is never written.

    We also see this with Preserve custom code / Customizable code = true on the entity (first generate of a new entity, not a regenerate of an existing file).

    Layout difference vs default We are not using the default abp-modal / abp-tabs structure. Our customized templates use a custom off-canvas panel (ta-offcanvas / ta-offcanvas-body / ta-offcanvas-footer) and place %%main-entity-tab%% + %%navigation-connection-lookup-tabs%% without wrapping opening abp-tabs tags / closing abp-tabs tags.

    Default templates generate correctly. Only these customized Create/Edit templates truncate after the property placeholders.

    Questions

    1. Besides keeping footer markup outside custom-code markers, is an opening abp-tabs tag / closing /abp-tabs tag wrapper around the two placeholders required for Suite to emit anything after %%navigation-connection-lookup-tabs%%?
    2. Is there another post-processing step (beyond custom-code-block removal and <abp-tab line removal) that drops the remainder of the template when the Create/Edit layout differs from the default modal?
    3. Can you confirm whether content after %%main-entity-tab%% / %%navigation-connection-lookup-tabs%% is expected to always be emitted for customized templates, or is that currently unsupported unless the default modal/tabs chrome is kept?
    4. What's the final soultion for this?
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    This is a bug in Suite's template processing on Windows, not something wrong with your templates — your changes from the previous round were fine.

    To fix the output now: remove %%main-entity-tab%% from both customized templates and put these placeholders directly in your panel body instead.

    CreateModal:

    %%<if:IsChildEntity>%%<abp-input asp-for="%%child-master-entity-name%%Id" />%%</if:IsChildEntity>%%
    %%input-properties%%
    %%navigation-property-lookup-inputs%%
    

    EditModal:

    %%<if:IsChildEntity>%%<abp-input asp-for="%%entity-name%%.%%child-master-entity-name%%Id" type="hidden" />%%</if:IsChildEntity>%%
    %%<if:CheckConcurrency>%%<abp-input asp-for="%%entity-name%%.ConcurrencyStamp" hidden="true" suppress-label="true"/>%%</if:CheckConcurrency>%%
    %%input-properties%%
    %%navigation-property-lookup-inputs%%
    

    These cover everything %%main-entity-tab%% produced (including the hidden master-id input for child entities and the concurrency stamp on the edit modal). After this change the full template is written — markers, footer and closing tags included.

    One note for later: if you add a navigation connection to an entity, %%navigation-connection-lookup-tabs%% emits <abp-tab> sections that expect a tabs container, so that part needs its own markup in an off-canvas layout.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.