1615435717
Sometime in our web application we may need to display contents in Popup Window. A popup window is a web browser window that is smaller than standard windows and without some of the standard features such as toolbars or status bars. Popups are one of the trickiest effects in web development, but in Blazor WebAssembly we can create it in simple way. All we need to Install a NuGet Package called, BlazoredModal. A BlazoredModal is a powerful and customizable modal implementation for Blazor applications.
Fig.1 Choose Create a new project option from Visual Studio
#blazor #modal popup #popup #wasm popup
1615435717
Sometime in our web application we may need to display contents in Popup Window. A popup window is a web browser window that is smaller than standard windows and without some of the standard features such as toolbars or status bars. Popups are one of the trickiest effects in web development, but in Blazor WebAssembly we can create it in simple way. All we need to Install a NuGet Package called, BlazoredModal. A BlazoredModal is a powerful and customizable modal implementation for Blazor applications.
Fig.1 Choose Create a new project option from Visual Studio
#blazor #modal popup #popup #wasm popup
1602560783
In this article, we’ll discuss how to use jQuery Ajax for ASP.NET Core MVC CRUD Operations using Bootstrap Modal. With jQuery Ajax, we can make HTTP request to controller action methods without reloading the entire page, like a single page application.
To demonstrate CRUD operations – insert, update, delete and retrieve, the project will be dealing with details of a normal bank transaction. GitHub repository for this demo project : https://bit.ly/33KTJAu.
Sub-topics discussed :
In Visual Studio 2019, Go to File > New > Project (Ctrl + Shift + N).
From new project window, Select Asp.Net Core Web Application_._
Once you provide the project name and location. Select Web Application(Model-View-Controller) and uncheck HTTPS Configuration. Above steps will create a brand new ASP.NET Core MVC project.
Let’s create a database for this application using Entity Framework Core. For that we’ve to install corresponding NuGet Packages. Right click on project from solution explorer, select Manage NuGet Packages_,_ From browse tab, install following 3 packages.
Now let’s define DB model class file – /Models/TransactionModel.cs.
public class TransactionModel
{
[Key]
public int TransactionId { get; set; }
[Column(TypeName ="nvarchar(12)")]
[DisplayName("Account Number")]
[Required(ErrorMessage ="This Field is required.")]
[MaxLength(12,ErrorMessage ="Maximum 12 characters only")]
public string AccountNumber { get; set; }
[Column(TypeName ="nvarchar(100)")]
[DisplayName("Beneficiary Name")]
[Required(ErrorMessage = "This Field is required.")]
public string BeneficiaryName { get; set; }
[Column(TypeName ="nvarchar(100)")]
[DisplayName("Bank Name")]
[Required(ErrorMessage = "This Field is required.")]
public string BankName { get; set; }
[Column(TypeName ="nvarchar(11)")]
[DisplayName("SWIFT Code")]
[Required(ErrorMessage = "This Field is required.")]
[MaxLength(11)]
public string SWIFTCode { get; set; }
[DisplayName("Amount")]
[Required(ErrorMessage = "This Field is required.")]
public int Amount { get; set; }
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
public DateTime Date { get; set; }
}
C#Copy
Here we’ve defined model properties for the transaction with proper validation. Now let’s define DbContextclass for EF Core.
#asp.net core article #asp.net core #add loading spinner in asp.net core #asp.net core crud without reloading #asp.net core jquery ajax form #asp.net core modal dialog #asp.net core mvc crud using jquery ajax #asp.net core mvc with jquery and ajax #asp.net core popup window #bootstrap modal popup in asp.net core mvc. bootstrap modal popup in asp.net core #delete and viewall in asp.net core #jquery ajax - insert #jquery ajax form post #modal popup dialog in asp.net core #no direct access action method #update #validation in modal popup
1661169600
Make Pop-Up Modal Window In Vanilla JavaScript
Learn how to create a simple responsive pop-up modal window using Vanilla JavaScript along with HTML and CSS with a bit of Flexbox.
Declare a <button> HTML element with an id open-modal.
<button id="open-modal">Open Modal Window</button>
The goal is when a user presses this button, the pop-up modal window will open.
Style the button using CSS Flexbox and centre it on the screen.
* {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
box-sizing: border-box;
}
body {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
button {
padding: 10px;
font-size: 1.1em;
background: #32bacf;
color: white;
border: none;
border-radius: 10px;
border: 1px solid rgba(0, 0, 0, 0.2);
cursor: pointer;
}
button:hover {
background: rgba(0, 0, 0, 0.7);
}
Normally, pop-up modal windows have overlays with a transparent darker background that covers the entire browser screen.
Define a div with an id model-overlay which will cover the entire screen.
<div id="modal-overlay">
<div>
Then, make it to full screen using height:100vh CSS property.
Bring it in front of the button by using position:absolute with a transparent background colour.
#modal-overlay {
width: 100%;
height: 100vh;
position: absolute;
background: rgba(0, 0, 0, 0.7);
}
I just added the border to see the boundaries of the modal-overlay element.
Create a div with an id modal inside the modal-overlay element, which will be an actually pop-up modal window that user interacts with.
<div id="modal-overlay">
<div id="modal">
</div>
<div>
Add CSS style to make it visible on the screen.
Adding width:100% and max-width:650px will make sure the width of the pop-up modal window won’t exceed when the browser width is more than 650px.
If the browser width is less than 650px, the pop-up modal window will stretch the width to fill the screen which is normally for mobile viewports.
#modal-overlay #modal {
max-width: 650px;
width: 100%;
background: white;
height: 400px;
}
Centre the pop-up modal window to the screen using Flexbox.
To do that, just add the three lines of Flexbox code to the modal-overlay which are
#modal-overlay {
...
display: flex;
align-items: center;
justify-content: center;
}
Now we have the basic pop-up modal window designed using CSS.
Make it visible when a user presses the open modal button.
To do that,
First, hide the modal overlay by default by changing its display property from flex to none.
#modal-overlay {
...
display: none; // Changed from flex to none
align-items: center;
justify-content: center;
}
Create a DOM reference to the open-modal button as well as the modal-overlay elements.
const openModalButton = document.getElementById("open-modal");
const modalWindowOverlay = document.getElementById("modal-overlay");
Attach a click event to the openModalButton with the callback arrow function showModalWindow.
const showModalWindow = () => {
modalWindowOverlay.style.display = 'flex';
}
openModalButton.addEventListener("click", showModalWindow);
Set the display property of the modalWindowOverlay to flex inside showModalWindow() function which will open up the modal window.
As you can see, there is no way we can close/hide the pop-up modalwindow after its became visible on the screen.
Let’s fix it!
Typically, there will be a close button on the top or bottom right side of the pop-up modal window.
Let’s add a close button on the bottom left side of the modal window.
Define header, content and footer HTML elements inside the pop-up modal window.
<div id="modal">
<div class="modal-header">
<h2>Modal Pop Up Window</h2>
</div>
<div class="modal-content">
<p>Modal Content</p>
</div>
<div class="modal-footer">
<button id="close-modal">Close</button>
<button>Save</button>
</div>
</div>
Generally, you’ll have two buttons on the footer of the pop-up modal window, which may be save and close.
Let’s push the buttons to the bottom using Flexbox.
Turn the display property of the pop-up modal window to flex and set the flex direction to column.
1598095640
#blazor #blazor in c# #blazor tutorial #blazor webassembly #blazor crud #blazor with asp.net core
1593023657
#blazor #blazor tutorial #blazor in c# #blazor crud #blazor webassembly #blazor with asp.net core