Posts

Showing posts from 2018

How to reset Checkbox as Unchecked(false)

How to reset Checkbox as Unchecked(false) 1.        Syntax for Html   Helper CheckBox:        @ Html.CheckBox( "Status" , isChecked: false ) 2.        Syntax for reset checkbox status as unchecked: $(“CheckboxId”).prop(“checked”,false)

Add data and create temporary table which contains the newly created data dynamically

Image
Add data and create temporary table which contains the newly created data dynamically write the below code in view @{     ViewBag.Title = "Index"; } <h2>Index</h2> <div class="row">     <div class="col-md-12">         <div class="col-md-2">@Html.Label("Fname", "First name", new { style = "width:110px" })</div>         <div class="col-md-2">@Html.Label("Lname", "Last name", new { style = "width:110px" })</div>         <div class="col-md-2">             @Html.Label("Gender", "Gender", new { style = "width:110px" })         </div>         <div class="col-md-2">             @Html.Label("Status", "Status", new { style = "width:110px;margin-left: -15px;" })         </div>   ...

How to create and add a new div inside parent div(“mainDiv”) but before the child div(“child”) of parent div(“maindiv”) using InsertBefore

How to create and add a new div inside parent div(“mainDiv”) but before the child div(“child”) of parent div(“maindiv”) using InsertBefore < div id ="mainDiv">     < div class ="row" id ="child">   </div> </div> var p = document.getElementById(“ mainDiv ”); var html=(”<div>puja</div>”); var exNode = document.getElementById( "child" ); var newElement = document.createElement(“<div>”); newElement.setAttribute( 'id' , “elementId”); newElement.innerHTML = html; p.insertBefore(newElement, exNode);

How to Remove the child div from parent div using javascript

How to Remove the child div from parent div using javascript function removeElement(elementId) {         // Removes an element from the document         var element = document.getElementById(elementId.id);         element.parentNode.removeChild(element);     } elementId: this is the parent div element.id: this is the id of the parent div

How to know the checkbox value using jquery

How to know the checkbox   value 1.        Syntax for Html   Helper CheckBox:        @ Html.CheckBox( "Status" , isChecked: false ) 2.        Syntax for getting checkbox status:          $( "#Status" ).is( ":checked" )

Static Data Binding in html DropDownList

Static Data Binding in html DropDownList @ Html.DropDownList( "Gender" ,          new List < SelectListItem > {                  new SelectListItem () { Text = "Male" , Value = "Male" },                  new SelectListItem { Text = "feMale" , Value = "FeMale" },                  new SelectListItem { Text = "Select Gender" , Value = "Select Gender" }                                    }, "Select Gender" )

Dynamic Adding data and show in list

Image
Add data and show temporaly in below grid and save data show in below list during final click on SaveData @{     ViewBag.Title = "Index"; } <h2>Index</h2> <h2>Index</h2> <div class="row" >     <div class="col-md-12">         <div class="col-md-2">@Html.Label("Fname", "First name", new { style = "width:110px" })</div>         <div class="col-md-2">@Html.Label("Lname", "Last name", new { style = "width:110px" })</div>         <div class="col-md-2">             @Html.Label("Gender", "Gender", new { style = "width:110px" })         </div>         <div class="col-md-2">                       @Html.Label("Status", "Status", new { style = "width:110px" })         ...

Static Binding Of Html DropDownListFor using Model Binding

Static Binding Of Html DropDownListFor using Model Binding   @ Html.DropDownListFor(m => m.Gender, new SelectList ( new List < Object > {   new {value= "Select"  ,  text= "Select" },                                                    new  {value= "Female"  ,text= "Female" },                                                       new  {value= "Male"  ,text= "Male" }   },  "value" ,  "text" , "Select" ),  new  { style= "width:100px" })                                                            ...

Override Authorize Filters in MVC

Image
Override Authorize Filters in MVC Authorize Filter: It is to limit the access for a user or user specific to the role. Implementation of Override Authorize filters in MVC Step1: Add a controller and named it as HomeController Add [Authorize] attribute before an action or a controller based on the requirement. Suppose user want to restrict the access of particular controller but allow some of action of that controller. So just add [Authorize] before controller                using System; using System.Web.Mvc; using System.Web.Mvc.Filters; namespace WebApplication1.Controllers {     [ Authorize ]     public class HomeController : Controller     {     } } Step 2: Create a class and named it as OverrideAuthorizeAttribute which should inherit AuthorizeAttribute and Implements IOverrideFilter    public ...

Currency Converter

Image
                Currency Converter Write the below code in view Default.aspx   < script type ="text/javascript" src ="http://code.jquery.com/jquery-1.8.2.js"></ script >         < script type ="text/javascript">             $( function () {              $( '#btnConvert' ).click( function () {               debugger ;               var amount = $( '#txtAmount' ).val();                var from = $( '#ddlfrom' ).val();                var to = $( '#ddlto' ).val();      ...