Here in this article we will learn how to create Toast Notifications in ASP.Net Core using toast plugin and can access the Toast notification in controller or class level in C# using below some steps.
Find Source Code
We have create this application using the below configurations.
– Visual Studio 2019 – .NET Core 5.0 SDK – ASP.Net core Toast Plugin
What is Toastr ?
Createing ASP.Net Core MVC application
Let’s create an ASP.Net Core MVC Application.
Install Toast notify package
The Toast Notifications is a free library for ASP.NET Core Applications. It is elegant and compatible with ASP.NET Core 3.1 and .NET 5.
In this article we will learn how to create & use material dashboard in angular. Please follow our previous article How to use angular material in angular. If you are new to angular then please explore our Angular Series where we discussed step by step process of angular from beginner to advance level.
We create a sample angular 9 application and there use in-built angular dashboard functionality.
Here we can see how to add angular material dashboard dynamically with card. We can do change the dashboard card columns and rows dynamically.
Add Material Design in Angular
To create the angular application use the below command. ng-material-dashboard is the project name.
After type the command in terminal window and hit enter then a prompt will ask to choose which material template want to install into the application like this. Let’s install first one “Indigo/Pink” you can chhose any other theme just navigate to the link.
Generating a Material Dashboard
To generate a material dashboard use the below command. This command should create a starter dashboard component.
ng generate @angular/material:material-dashboard --name = <Name of Dashboard>
material-dashboard is a starter component, which generates a group of the materialized components in the form of the dashboard by just providing a name. To create the dashboard run the below command
ng generate @angular/material:material-dashboard --name material-dashboard
And as you can see in the console, there are a few files created inside the app directory with a component name provided. The file structure looks like the below screen.
After installing this you can see the material-dashboard ts, html and css file automatically created.
You can see here when the material-dashboard component is created it automatically add the required module inside app.module.ts
In the below typescript we create a Cards list that return how many columns and rows. You can change the column and row to set dynamically.
The below snippet is a basic building block which was generated by the component generator. Dynamically bind the cards from material-dashboard.component.ts and using *ngFor iterate the result through material components.
In this article we will discuss how to export PDF in ASP .NET MVC. Here we discuss export into PDF without using any 3rd party libraries. Please go through our previous article Export data into Excel in ASP.NET MVC. If are new to in ASP .NET MVC for step by step access please explore ASP .NET MVC Series.
To connect with database and fetch the record, her ewe use Dapper ORM.
What is Dapper ?
Dapper is an object-relational mapping product for the Microsoft .NET platform: it provides a framework for mapping an object-oriented domain model to a traditional relational database. Its purpose is to relieve the developer from a significant portion of relational data persistence-related programming tasks.
Add Dapper package in Nuget
Add another class in Models folder to retrieve the employee information from database.
Here We create the IDbConnection that hold the connection string information.
Using Dapper ORM fetch the employee tables.
In real-time application you may use Stored procedure instead of text.
Dapper ORM directly return the list of employee.
Here we create object of the employee repository class.
In the Index() we fetch the employee list and return to the view.
Here we use scaffold technique to create list of employees.
Added a button to Export the data into PDF.
Export is the action method and Employee is the Controller.
Export Action method to convert PDF
In the export Post method we fetch the employee information.
To export data into PDF we use Gridview controls that are in System.Web.UI.WebControls namespace.
In Gridview controls hold the employee list.
In the string writer and string Reader st the PDF using HTMLWorker.
Response content type as PDF and finally append the PDFdoc that export into PDF.
Run the application and see the output
After click the export button it convert the above data into PDF like below;
This article explained how to export PDF in ASP.NET MVC . In this example we use Dapper ORM to fetch the data from database and using the data we export into PDF using Gridview controls that are available in System.Web.UI.WebControl namespace. Please free to feel if have any suggestion or feedback about this article.
In this article we discuss read external JSON file in Jquery Ajax. If you are new to Jquery then please explore our Jquery Series. There are many ways to store JSON data in our application. We can store JSON in an array or in an external file. There are many ways to read JSON data from external files, here we see how it be done using Jquery Ajax.
What is Ajax ?
Ajax is a set of web development techniques using many web technologies on the client side to create asynchronous web applications. With Ajax, web applications can send and retrieve data from a server asynchronously without interfering with the display and behavior of the existing page.
Let’s you have a external JSON file named as sample.json and it holds the JSON value like below;
On the above we create a AJAX method to read the external JSON fileby passing in the ajax URL. After getting response print the result in the DIV tag. Also if we open the browser console window you can see the output like below;
After run the application you can see the output like below;
This article explained how to use external Json file in Jquery Ajax. If have any suggestion about this article please give your feedback.