Posts

Showing posts with the label ASP.NET MVC

Donate

ASP.NET MVC Web Application CRUD Using RepoDB ORM

Image
Happy Sunday Awesome Programmers! See the ASP.NET Core MVC version of this tutorial here Create An ASP.NET Core MVC CRUD Website Using RepoDB ORM And SQL Server A week ago, I received a newsletter regarding a promising ORM called RepoDB. This ORM library is created by Michael Pendon who is an application architect in Europe. According to him, RepoDB is an open-source . NET ORM library that bridges the gaps of micro-ORMs and full-ORMs. It helps you simplify the switch-over of when to use the BASIC and ADVANCE operations during the development. It is your best alternative ORM to both Dapper and EntityFramework . It also provides query support to several databases such as MySQL, SQL Server, PostGreSQL and there's a survey that this ORM's performance is faster than Dapper. I've used Dapper before and Entity framework in my ASP.NET MVC applications so, it's time to try using this tool by creating a simple ASP.NET MVC CRUD Application(Create, Read, Update, Delete) Applic

ASP.NET MVC Bind Or Populate jsTree From SQL Server Database

Image
Hello Everyone, Normally when working with real world information, we tend to have projects or tasks that will show employees with their supervisors or managers viewed in hierarchical structure. If the given project is a web application, the jsTree.js fits for this requirement. This article will show you how to populate a jsTree from SQL Server database table called ContosoRetailsDW which is a Microsoft sample database. It already has a table specifically DimEmployee that we can play with. To begin with lets define the models used. The JsTreeModel class contains the information used by the jsTree while the clsResourceManagers class receives the result from the query. public class EmpManagerTreeViewModel { public clsResourceManagers ResourceManager { get ; set ; } public JsTreeModel EmployeeTreeModel { get ; set ; } public EmpManagerTreeViewModel() { ResourceManager = new clsResourceManagers(); EmployeeTreeModel = new JsTreeModel(); } } public class clsRes

Bootstrap Modal In ASP.NET MVC With CRUD Operations

Image
Good afternoon fellow developers! I have been working with Bootstrap Modals before and it's time to demonstrate its significance using a simple ASP.NET MVC CRUD (Create Update Delete) application project using Entity Framework Database First approach. First is to create a basic BookDetails table on your SQL Server instance. USE [DemoDB] GO /****** Object: Table [dbo].[BookDetails] Script Date: 11/2/2020 12:26:53 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[BookDetails]( [BookSerialNo] [int] IDENTITY (1,1) NOT NULL , [BookISBN] [ nchar ](15) NULL , [BookTitle] [varchar](120) NULL , [BookAuthor] [varchar](60) NULL , [BookPublisher] [varchar](50) NULL , [BookCategory] [varchar](20) NULL , PRIMARY KEY CLUSTERED ( [BookSerialNo] ASC ) WITH (PAD_INDEX = OFF , STATISTICS_NORECOMPUTE = OFF , IGNORE_DUP_KEY = OFF , ALLOW_ROW_LOCKS = ON , ALLOW_PAGE_LOCKS = ON ) ON [ PRIMARY ] ) ON [ PRIMARY ] GO Next is to create an ASP.

Bootstrap Table Format Numbers With Comma And Decimal Places In ASP.NET MVC

Image
Hello and Good Evening. Here's how to format numbers with comma and decimal places in Bootstrap Table columns by Wenzhixin using data-formatter tag. Simple set the data-formatter property of the tag. <table id= "tblBilling" data-toggle= "table" data-search= "true" data-advanced-search= "true" data-id-table= "billingTable" data-show-export= "true" data-toolbar= "#toolbar1" data-click-to-select= "true" data-height= "500" data-url= '@Url.Action("GetBillingInformation", "BillingDashboard")' data-cookie-id-table= "tblBillableID" > <thead> <tr style= "background-color: #FFFFFF;" > <td data-field= "CustomerID" data-sortable= "false" data-searchable= "false" data-visible= "false" >Customer ID</td> <td data-field= "

Custom JavaScript Date Time Sorter and Date Time Formatter Function For Bootstrap Table in ASP.NET MVC Using Moment.JS

 Hello Fellow Developers, Here's how to format and sort dates with time values using Bootstrap Table by Wenzhixin in ASP.NET MVC. Assuming that the values returned from the database have hours, minutes and seconds. DateTimeFormatter function DateTimeFormatter(value, row, index) { if (value === null || value === undefined || value === "" ) { return "" ; } else { return moment(value).format( 'YYYY-MM-DD HH:mm:ss' ); } } DateTimeSorter function DateTimeSorter(a, b) { var dateA = new Date(moment(a).format( 'YYYY-MM-DD HH:mm:ss' )); var dateB = new Date(moment(b).format( 'YYYY-MM-DD HH:mm:ss' )); if (dateA < dateB) return -1; if (dateA > dateB) return 1; return -0; } Usage <th data-field= "LastLogin" data-sortable= "true" data-sorter= "DateTimeSorter" data-formatter= "DateTimeFormatter" data-searchabl

Bootstrap Table Uncheck The Checkboxes On Page Load

Good evening all! When working with checkboxes in Bootstrap Table created by Wenzhixin, you may have notice that on page load the checkboxes are checked by default. If you want to uncheck these checkboxes on page load of your ASP.NET MVC page, call the checkInvert method of the bootstrap table on document ready of the page such as the code below: $(document).ready( function () { UncheckShoppingCartTable(); }); function UncheckShoppingCartTable() { $( '#tblShoppingCart' ).bootstrapTable( 'checkInvert' ); }

Custom AuthorizeAttribute Class In ASP.NET MVC

Hello All! In ASP.NET MVC projects, you would normally handle Unauthorized users if they access to a page in which they don't have access to. To do this I have a custom class that inherits the AuthorizeAttribute class. This class was take from accepted answers in stackoverflow with some modifications according to my needs for the project. Here's the complete AuthorizeUser class. using System.Configuration; using System.Web.Mvc; namespace AuthenticationDemo { public class AuthorizeUsersAttribute : AuthorizeAttribute { private string redirectUrl = "" ; public string NotifyUrl { get { return redirectUrl; } set { redirectUrl = value ; } } public AuthorizeUsersAttribute() : base () { } public AuthorizeUsersAttribute( string redirectUrl) : base () { this .redirectUrl = redirectUrl; } protected ov

How To Debug Or Step Through A WCF Service In ASP.NET MVC Application

Hello, In order to step through the WCF project in debugging mode through and ASP.NET MVC, follow these simple steps. WCF Project 1. Right click on the Solution of the WCF Service Project 2. Choose Properties 3. On Startup Project -> Select Multiple startup projects 4. On the Action dropdown of the WCF Service project, choose "Start". ASP.NET MVC Project 1. Run the WCF Service Project using the default web browser 2. Add a WCF connection using Connected Services (Make sure to type the correct url of the service). See web.config value below. 3. In web.config, add an endpoint element for the WCF service. <endpoint address= "http://localhost:63070/Service.svc" binding= "basicHttpBinding" bindingConfiguration= "BasicHttpBinding_Service1" contract= "DataLocalHostService.DataService" name= "BasicHttpBinding_Service1" /> 4. In your controller, you may call the service based from

Donate