Friday, 31 January 2020

Custom Polyline with multiple icons in google map


<!DOCTYPE html>
<html>
<head>
  <title></title>
  <style type="text/css">
html,
body,
#map {
  height: 100%;
  margin: 0;
  padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<!-- Replace the value of the key parameter with your own API key. -->
<script async defer
        src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap">
</script>
<script type="text/javascript">
  function initMap() {
  var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 3,
    center: {
      lat: 0,
      lng: -180
    },
    mapTypeId: google.maps.MapTypeId.ROADMAP
  });
 var lineSymbol=[];
 var icons=[];
 var time=["Flair Towers - South Towers<br/>10:30 AM","Flair1 Towers - South Towers <br/>11:00 AM","IBM Plaza<br/>11:35 AM","Cebu Pecific<br/>12:15 PM"];
  var path = [{lat: 37.772,lng: -122.214},
    {lat: 21.291,lng: -157.821},
    {lat: -18.142,lng: 178.431},
    {lat: -27.467,lng: 153.027}
  ];
  var infowindow = new google.maps.InfoWindow();
  if(path.length>0){
    for(var j=0;j<path.length;j++){
      lineSymbol.push(new google.maps.Marker({icon:{anchor:new google.maps.Point(16,16), origin: new google.maps.Point(0, 0),scaledSize: new google.maps.Size(32, 32),size: new google.maps.Size(64, 64),url: "D:\\truck.png"},position: path[j],map:map}));
    icons.push({icon: lineSymbol[j],offset:"100%"});
 
      google.maps.event.addListener(lineSymbol[j], 'click', (function(marker, time, infowindow) {
        return function(evt) {
          infowindow.setContent(time);
          infowindow.open(map, marker);
        }
      })(lineSymbol[j], time[j], infowindow));
     google.maps.event.trigger(lineSymbol[j], 'click');
    }
  }

  var Line = new google.maps.Polyline({
    path: path,
    geodesic: true,
    strokeColor: "#35495e",
    strokeOpacity: 0.8,
    strokeWeight: 4,
    icons:icons,
  });
  debugger;
  Line.setMap(map);
   var bounds = new google.maps.LatLngBounds();
   for (var i = 0; i < Line.getPath().getLength(); i++) {
    bounds.extend(Line.getPath().getAt(i));
  }
  map.fitBounds(bounds);

}
</script>
</body>
</html>


Wednesday, 29 January 2020

How to get list through ajax jquery in c#

Here is simplify method with example please read and practice carefully then definitely you'll do this.

The first method is using get method..

$.ajax({
url:"/Home/GetUserList", /// this is URL  "HOME"- COntroller name, GetUserList-Method Name
type:"GET",   /// define type GET or POST
datatype:"json", /// datatype format
Content-Type:"application/json",
data:{}
success:function(response){
    alert("We got it user list").
}
error: function(response){
alert("we can't found the user list, there is something error");
}
})

Tuesday, 28 January 2020

Get all column names from database table with specific schema in SQL Server

Many times there’s a requirement to get all columns for a particular table in database. Hence here is a SQL Query that does that.


SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Your Table Name'
ORDER BY ORDINAL_POSITION

Monday, 20 January 2020

How to control image shown error if the image not found on the location

I like to use this way, so that whenever original image is not available you can load your default image that may be your favorite smiley or image saying Sorry ! Not Available, But in case if both the images are missing you can use text to display. where you can also you smiley then. have a look almost covers every case.


<img src="path_to_original_img/img.png"  alt="Sorry! Image not available at this time" 
       onError="this.onerror=null;this.src='<?=base_url()?>assets1/img/default.jpg';">

redirect to new page from jquery

  function foo(id) { var url = ' @Url . Action ( "Details" , "Branch" , new { id = "__id__" })'...