Solved

Google Maps Component MVC5

Posted on 2016-11-17
1
44 Views
Last Modified: 2016-11-20
I'm currently using the Googlemap control component for Asp.NET MVC   to render maps from GoogleMaps.

I am using this component because I will have to trace the route of a vehicle coming from the database via model, then I will use the DataBinding option of the component.

The problem is that I'm using it inside a div with bootstrap.

<div class="col-md-10">
    <div class="content-box-header">
        <div class="panel-title">Mapa</div>
    </div>
    <div class="content-box-large box-with-header">
        <div id="map-canvas">


            @(Html.GoogleMap()
                  .Name("map")
                  .Width(750)
                  .Height(350)
                  .Zoom(18)
                  .MapTypeId(MapType.Satellite)
                  .Center(c => c.Latitude(-23.4554d)
                      .Longitude(-46.6257d))
                  .Culture(CultureInfo.GetCultureInfo("pt-BR"))
                  .Markers(marker =>
                  {
                      marker.Add()
                          .Latitude(-23.4554d)
                          .Longitude(-46.6257d)
                          .Title("Hello World!")
                          .Icon("~/Content/img/6.png", new Size(20, 32), new Point(0, 0), new Point(0, 32))
                          .Draggable(true);
                  }))
        </div>
    </div>
</div>

Open in new window


The bad thing is that the component needs me to tell the value of the height and width of the map to be rendered (Width, Height), then the map is no longer responsive.

Any way to calculate the div width / height value dynamically?

Or some other free component that you can use?
0
Comment
Question by:berechit
1 Comment
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 41895150
I have no experience with this component (or even MVC for that matter) but when I click on the link you provided and go to the first example, it states you can use 0 for automatic width and height. Can you try that?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
This Micro Tutorial will demonstrate without sampling how to find out top organic landing pages. The hack gets around the standard way to find the pages in Google Analytics results in sampling for larger sites.
This Micro Tutorial demonstrates in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question