Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8696007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:10:38+00:00 2026-06-13T01:10:38+00:00

Why I get this error? Compiler Error Message: CS1061: ‘System.Collections.Generic.IEnumerable’ does not contain a

  • 0

Why I get this error?

Compiler Error Message: CS1061: ‘System.Collections.Generic.IEnumerable’ does not contain a definition for ‘lat’ and no extension method ‘lat’ accepting a first argument of type ‘System.Collections.Generic.IEnumerable’ could be found (are you missing a using directive or an assembly reference?)

.Ado Model

int, lat, lng, contents

Controller

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MapApp.Models;

namespace MapApp.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        mapEntities _db = new mapEntities();

        public ActionResult Index()
        {
            return View(_db.river);
        }

        public ActionResult About()
        {
            return View();
        }
    }
}

View

@model IEnumerable<MapApp.Models.river>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2> Index</h2>
<script type="text/javascript">
@foreach (var item in Model)
{
    <text>
      var markerlatLng = new google.maps.LatLng(@(Model.lat), @(Model.lng));
      var contents = '@(Model.contents)';

      var infowindow = new google.maps.InfoWindow({
          content: contents
      });

      var marker = new google.maps.Marker({
          position: markerlatLng,
          title: contents,
          map: map,
          draggable: false
      });

      google.maps.event.addListener(marker, 'click', function () {
          infowindow.open(map, marker);
      });

   </text>
}
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T01:10:39+00:00Added an answer on June 13, 2026 at 1:10 am

    Got it fixed!

    Controller

    public class HomeController : Controller
    {
        mapEntities _db = new mapEntities();
    
        public ActionResult Index()
        {
            return View(_db.river.ToList());
        }
    }
    

    View

    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">
    
    $(function () {
        var latLng = new google.maps.LatLng(52.379397, 4.889644); // Amsterdam
        var map = new google.maps.Map(document.getElementById('map-canvas'), {
            zoom: 15,
            center: latLng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        });
    
        function addMarker(latitude, longitude, title)
        {
            var markerLatLng = new google.maps.LatLng(latitude, longitude);
            var title = title;
    
            var marker = new google.maps.Marker({
                position: markerLatLng,
                title: title,
                map: map,
                draggable: false
            });
        };
    
       @foreach (var item in Model)
       {  
         @:addMarker(@item.latitude, @item.longitude, "@item.title");
       }
    
    }); 
    
    </script>
    <div id="map-canvas">
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get this error while accessing a php script: W/System.err: Error reading from ./org/apache/harmony/awt/www/content/text/html.class
Sometimes in execution I get this error message in VS2010 when trying to free
When I run rvm install ruby-1.9.3 , I get this error message when configuring
I get this error when running any new ASP.NET MVC 4 project: Compiler Error
I get this error when trying to make the executable, the code compiles correctly
I always get this error when trying to compile my file with Boost::GIL PNG
When I compile a project I get this error: C:\DATOSA~1\FAXENG~1>nmake /f Makefile.vc clean Microsoft
How can I get this to compile? The error is when I start using
I get a compile error, which I'm slightly confused about. This is on VS2003.
When I try to compile this project I get the following error. I would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.