Solved

Google Maps Component MVC5

Posted on 2016-11-17
1
69 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

In this blog, I will share you some basic tips for content marketing and to rank your website on Google.
Some of the SEO trends we might expect in 2017.
This Micro Tutorial will introduce a Google tool, which is a great way to learn more about dimensions in metrics in Google Analytics, even if you use the interface or the API.
This Micro Tutorial will demonstrate Google Calendar to monitor updates with top sites, such as Facebook, Google, Twitter, etc. with Marketing News. Each update of Google Calendar can be monitored, correlate dips and spikes in your website traffic, …

696 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