Solved

Google Maps Component MVC5

Posted on 2016-11-17
1
18 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Learn about cloud computing and its benefits for small business owners.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will demonstrate importing calendar invites from events such as webinars into your Google Calendar.
This Micro Tutorial demonstrates the importance of annotations in Google Analytics and how they should be used to document changes made to a site, Google updates (Ex: Panda & Penguin), marketing campaigns, and any other events that might have contri…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now