简体   繁体   中英

Display a modal Pop up in ASP.NET MVC

I am currently developing an MVC project that requires giving the client 30 days trial. As from 5 days to the end of the trial, i want to start displaying warning messages to the user. I registered a Subscription Attribute which works just like the Authorize Attribute in ASP.NET MVC.

How it works:

While the client is working i check if(trial period <= 5 days) .

If true, an HttpSubscriptionExpiredResult Action Result is returned, which produces a customized status code. This status code is intercepted by the SubscriptionModule , which then redirects to the warning page.

My Needs:

I want the warning Action Method to return a modal pop up (or just a pop up). Or simply put: I want the warning message displayed in a modal pop up. This will prevent disrupting the client's work. How do i achieve this?

This status code is intercepted by the SubscriptionModule, which then redirects to the warning page .

There are lots of methods to make an modal popup in HTML pages; the simplest one is presented at Simple jQuery Modal Window Tutorial

In your warning page put the following JavaScript code

$(document).ready(function () {
    //id is the ID for the DIV you want to display it as modal window
    launchWindow(id);
}); 

It shows a nice popup window.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM