Posts

Allow only numbers/decimal in input box

If your requirement is to allow only numeric and decimal numbers in input box using the vanilla javascript then this post will help you in this. Let’s get started Step 1 – HTML Code < input   id ="txtWinAmt"   type ="text"   class ="inputbox"   style =" width : 60px ;  height : 19px ; line-height : 1px"   oninput =" ValidateInputIsNumber( this ) "   /> Step 2 – javascript code     var regEx = new RegExp(/^\d*\.?\d*$/);     var lastValid="";     function ValidateInputIsNumber(controlId)     {         if(controlId.value.length==1)             lastValid="";         if (regEx.test(controlId.value))             lastValid = controlId.value;         else             controlId.value = lastValid;     }

Checkbox list in ASP.Net MVC

Image
Recently, I got an assignment when I need to show the items in checkbox list format. It was very easy in ASP.NET web form because it has CheckBoxList control but it was bit challenging for me to show the items in checkbox list in ASP.NET MVC as there are basic controls available. In this post I am going to explain you how to build the CheckBoxList control in ASP.NET MVC using the basic control and Razor engine following the steps listed below. Let’s get started Step 1. First thing first, View Code @model  SOW.Models. DropdownValues      < table >          < tr >              < td   class ="td_12per"> Select Country: </ td >              < td   class ="td_12per">              ...

jsGrid

Image
I was working one a Asp.Net MVC application where I was using the Web Grid to display the data based on the selected search criteria. It was working great but client asked me to use the jsGrid instead of Web Grid as it has many ready to use features like (Edit, Delete, Search, etc..).  Initially, jsGrid gave me very hard time to display the data in it but after few hit and trial I manage to display the data. After spending couple of hours on jsGrid, I started liking it. In this article, I am going to explain how to use the jsGrid to display the data and some other tactics in very easy steps. I am building the application in ASP.NET MVC. Step 1. Content delivery network (CDN) of jsGrid and jQuery libraries are as below https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid.min.css https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid.css https://cdnjs.cloudflare.com/ajax/libs/jsgrid/1.5.3/jsgrid-theme.min.css https://code.jquery.com/jquery.min.js ...

Partial Page in ASP.NET MVC

How to use the partial pages in ASP.NET MVC I was working on a ASP.NET MVC project where requirement was to create dashboard for the user and display the request based on their status in different tables. Initially, I thought to create tables using JavaScript frameworks. But there was another side of story, requirement was to add the CRUD operations on each record. I am not saying that this is not achievable in JavaScript but I was looking for the simple solution. I explore multiple options and found that partial page implementation is the right solution of my problem. I followed below steps to implement the partial page functionality for my requirement. If you think you have a different/simple approach feel free to leave your suggestion in the comment section down below. Step 1. Form Layout   < div class ="form-horizontal">         < div class ="col-md-6">             < h4 ...