0

If the user has made changes in the form and attempts to leave the page, a popup will appear. The popup is functioning correctly for leaving the page. However, when the user tries to switch tabs, the popup does not display, but the page gets blurred. Form code :- @using (Html.BeginForm(action, "Campaign", method: FormMethod.Post, htmlAttributes: new { enctype = "multipart/form-data", @class = "form-horizontal col-sm-12", @id = "CampaignDetail", onkeydown = "return event.keyCode!=13", @onsubmit = "return onSubmitForm();" })) Tab code :- @{ Detail if (!Model.Stage.Equals("RFQ")) { @ Comments @ @if (hasAgreementsPermission) { Agreement } Assets @if (hasScriptsPermission) { Scripts } Pacing Schedule @if (!isVendor) { Vendor } @if (Model.Stage.Equals("Live") || Model.Stage.Equals("Completed") || Model.Stage.Equals("Paused")) { Lead List } } else { if (ViewBag.UserType == TC.Model.Entities.UserTypeMappings.Vendor) { Quotation } else { Allocations } } Life Cycle Log } $(document).ready(function () { $('button[data-bs-toggle="tab"]').on('show.bs.tab', function (e) { localStorage.setItem('activeTab', $(e.target).attr('id')); }); var activeTab = localStorage.getItem('activeTab'); if (activeTab) { $('#SummaryTab button[id="' + activeTab + '"]').click(); } });

Remember i am using asp.net mvc core and my tabs are in partial view and my bootstraped moodel is in main view.

I have tried javascirpt confirm event for this but still it is not working

1
  • Could you please try to format the code you're sharing ? If people can more easely read your question they'll be more inclined to answer it : Stack overflow editing help
    – Tibère B.
    Commented May 6 at 9:37

0