Posts

Showing posts from 2016

Sorting HTML Table

function sortTable() {     var table = document.getElementById('tblGetRate');     var rowLength = table.rows.length;     var rateValue = [];     for (var i = 0; i < rowLength; i += 1) {         var row = table.rows[i];         if ($(row).has("td.rate").length > 0) {             rateValue.push([$(row).find("td").eq(4).html().replace('$', '').trim(), row]);         }     }     rateValue.sort(function (a, b) { return b[0] - a[0] });     for (var i = 0; i < rateValue.length; i++) {         $(rateValue[i][1]).remove();         $('#tblGetRate').prepend(rateValue[i][1]);     } }

Web Grid MVC

@model MvcApplication30.Models.PagedStudentModel @{     ViewBag.Title = "WebGrid CRUD Operations";     WebGrid grid = new WebGrid(rowsPerPage: Model.PageSize);     grid.Bind(Model.It_Student,               autoSortAndPage: false,               rowCount: Model.TotalRows     ); } Add New Student @grid.GetHtml( htmlAttributes: new { id = "grid" },     fillEmptyRows: false,     mode: WebGridPagerModes.All,     firstText: "<< First",     previousText: "< Prev",     nextText: "Next >",     lastText: "Last >>",      columns: new[] {                 grid.Column("StudentID",                     header: "ID", canSort: true),         grid.Column(header: "Stu...

Option button binding using javascript

  function CreateContryDropdown(countryList) {         debugger;         var result = " ";         if (countryList.length > 0) {             for (var index = 0; index < countryList.length; index++) {                 result += " " + countryList[index].Name + " ";             }                   }         result += " ";        return result;     } ---------------------- function CreateHazPKGListType(selectedVal) {     debugger;     var result = " ";     if (selectedVal != "") {         result += " --Select-- ";     } else {         result += " --Select-- ";     }     if (hazPKGList.length > 0) {  ...

Google Map Draw route between two cities

var markers = []; var map = ''; function ShowTrack(address) {     markers = [];     debugger;     var lst = address.split('~');     GetMarkers(address);     {         if (lst.length > 1) {             var mapOptions = {                 center: new google.maps.LatLng(markers[0].lat, markers[0].lng),                 zoom: 10,                 mapTypeId: google.maps.MapTypeId.ROADMAP             };             map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);             var lat_lng = new Array();             var latlng = [];             var myLatlng = [];       ...