Posts

Showing posts from January, 2019

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">              ...