1
我有數據在數據庫中是這樣的:如何在谷歌搜索位置圖
Database table
Name : Jack
mob_number : 445452454
address : al saada street
country : dubai
在我看來
@item.Name
@item.address
@item.country
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(40.716948, -74.003563);
var options = {
zoom: 14,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"), options);
}
initialize();
</script>
我如何通過@ item.address谷歌搜索位置的地圖?
我的觀點:
@if (Model != null)
{
if (Model.Count() != 0)
{
<div class="">
@foreach (var item in Model)
{
<div class="tiptext">
<b style="margin-left: 0px; font-size: large;color: #1A0DB2;">@item.BusinessName</b>
<h3 style="margin: 5px 0px 5px 0px;color: rgb(0, 145, 0);"> @item.FirstName</h3>
<h3 style="margin: 8px; color:black">@item.BusinessCategory </h3>
<div class="description">
<div class="description_image">
<img src="~/Images/popup_pointer.jpg" />
<div class="POP_UP_outer">
<div class="description_background">
<div class="description_map">
<b>Map</b>
</div><hr />
<div class="description_body">
<b>Description </b><h4 class="des">@item.BusinessDescription</h4>
<b>Address2 </b><h4 class="des">@item.Address1</h4>
<b>Email </b><h4 style="color:blue; margin: 5px 0px 5px 0px;">@item.EmailID </h4>
<b>WorkNumber </b><h4 class="des">@item.WorkNumber</h4>
<b>MobileNumber </b><h4 class="des">@item.MobileNumber</h4>
<b>City </b><h4 class="des">@item.City</h4>
<b>State </b><h4 class="des">@item.State</h4>
<b>ZipCode </b><h4 class="des">@item.ZipCode</h4>
@Html.ActionLink("Book An Appointment", "CalendarView", "Appt", new { id = @item.UserID }, null)
@*@Html.ActionLink("Book An Appointment", "Popup", "Search", new { @class = "openDialog", data_dialog_id = "aboutlDialog", data_dialog_title = "Additinal Customer" })*@
</div>
</div>
</div>
</div>
</div>
</div>
}
</div>
}
else
{
<label id="lblErrorMsg" title="Record not fount...!" style="color:red;">Record not found...!</label>
}
哈弗腳本
<script type="text/javascript">
$(".tiptext").mouseover(function() {
$(this).children(".description").show();
}).mouseout(function() {
$(this).children(".description").hide();
});
</script>
可以看出U 地圖對我的看法,我想加載地圖有
sir ..在這個例子中var address =「San Diego,CA」;被稱爲靜態..我怎麼能通過傳遞@ item.address – Jajin
'var address = @ item.address' – stuartd
從數據庫中調用它聲明var address = @ item.address – Jajin