There is a master page in my web page in which inside content place holder im writing 2 Java Script.
1 is for progress bar and 2nd is for geo map, as below:
C#:
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<%--JavaScript for progress bar in Gridview--%>
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script type="text/javascript">
$(function () {
$(".progress").each(function () {
$(this).progressbar({
value: parseInt($(this).find('.progress-label').text())
});
});
});
</script>
<asp:GridView ID="QualicisionGridView" runat="server" AutoGenerateColumns="False" Width="100%" PageSize="5" AllowPaging="True"
OnPageIndexChanging="QualicisionGridView_PageIndexChanging" BorderColor="#e5e4e2" BorderStyle="solid" BorderWidth="2px">
<RowStyle CssClass="Grid" />
<Columns>
<asp:BoundField HeaderText="No" DataField="id" ItemStyle-CssClass="ColumnAlignment"/>
<asp:TemplateField ItemStyle-Width="200">
<ItemTemplate>
<div class='progress'>
<div class="progress-label" style="display:none">
<%# Eval("Values") %>
</div>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<div id="dvMap" style="width: 712px; height: 350px;"></div>
<%--Javascript for GeoMap--%>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
var google_markers = new Array();
var markers = [
<asp:Repeater ID="rptMarkers" runat="server">
<ItemTemplate>
{
"title": '<%# Eval("StationName") %>',
"lat": '<%# Eval("Latitude") %>',
"lng": '<%# Eval("Longitude") %>',
"description": '<%# Eval("State") %>',
"type": 'No status'
}
</ItemTemplate>
<SeparatorTemplate>
,
</SeparatorTemplate>
</asp:Repeater>
];
</script>
<script type="text/javascript">
window.onload = function () {
var mapOptions = {
center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP,
// panControl:false,
streetViewControl: false,
mapTypeControl: true
};
var infoWindow = new google.maps.InfoWindow();
var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
for (i = 0; i < markers.length; i++) {
var data = markers[i]
var myLatlng = new google.maps.LatLng(data.lat, data.lng);
var icon = "";
switch (data.type) {
case "Danger":
icon = "red";
break;
case "Normal":
icon = "green";
break;
case "Warning":
icon = "yellow";
break;
case "No status":
icon = "blue";
break;
}
icon = "http://maps.google.com/mapfiles/ms/icons/" + icon + ".png";
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: data.title,
animation: google.maps.Animation.DROP,
displayMode: 'markers',
colorAxis: { colors: ['green', 'blue'] },
icon: new google.maps.MarkerImage(icon)
});
(function (marker, data) {
google.maps.event.addListener(marker, "click", function (e) {
infoWindow.setContent(data.description);
infoWindow.open(map, marker);
});
})(marker, data);
google_markers[google_markers.length] = marker;
}
}
</script>
</asp:Content>
but "progress bar" javascript is throwing script error : Object doesn't support property or method 'progressbar'
Javascript for "progress bar" is not working if I put the Geo map script in the same page.
I need both the functionality on same page.
How to make both the script work without any error.
Please reply.