Create a procedure to fetch data from the database in SQL
- After creating the above procedure, create a new application containing a master page in Visual Studio.
- Add a reference to Newtonsoft.Json from the NuGet Package Manager in your solution.
- Add a new content page by right-clicking on the master page in your solution.
Step 1. Master Page Setup
Ensure that jQuery and Flot libraries are correctly included in your Site. Master files are being loaded before your custom script.
Site.Master
Step 2. Master Page Code-Behind
Retrieve data from the database and serialize it to JSON format in your Site. Master. cs.
Site.Master. cs
Step 3. Content Page Setup
Set up the content page to include a chart container and the JavaScript to plot the chart.
Default.aspx
By following these steps, you should be able to retrieve data from the database and display it in a bar chart using jQuery Flot in an ASP.NET C# application.
Site.Master
![HTML]()
![Script]()
Default. aspx Content Page
![Content Page]()
![Div class]()
Site.Master.cs
![System]()
![ChartData]()
![Private void]()
Output :
![]()