Solved

Google Maps Component MVC5

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Does Google Docs require GMail? 2 37
Vb.net dynamic formulas in runtime 11 62
SQL Login 17 40
Website has been flagged by Google as Unsafe 10 18
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Learn about cloud computing and its benefits for small business owners.
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 the easy use of Gmail embedding images in your email so the recipient of your email can view them in context.

920 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

15 Experts available now in Live!

Get 1:1 Help Now