using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class xyz : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Bindcity();
}
protected void Bindcity()
{
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["IHPDB"].ConnectionString))
{
con.Open();
SqlCommand cmd = new SqlCommand("select T_Description from Lookupmaster where Lookup_Type='C'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
ddcity.DataSource = ds;
ddcity.DataTextField = "T_Description";
//ddcity.DataValueField = "id";
ddcity.DataBind();
ddcity.Items.Insert(0, new ListItem("--- Select ---", "0"));
con.Close();
}
}
protected void ddcity_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
Form design:
javascript:
src="http://code.jquery.com/jquery-1.9.1.js";
src = "http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false";
$(document).ready(function () {
var gmarkers = [];
var map;
function initialize() {
var mapProp = {
// center: new google.maps.LatLng(20.593684, 78.96288), //India Lat and Lon
center: new google.maps.LatLng(),
zoom: 4,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("googleMap"), mapProp);
}
google.maps.event.addDomListener(window, 'load', initialize);
$("#ddcity").change(function () {
var city = $("#ddcity").val();
var geocoder = new google.maps.Geocoder();
var com = city;
geocoder.geocode({ 'address': com }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var x = results[0].geometry.location.lat();
var y = results[0].geometry.location.lng();
var latlng = new google.maps.LatLng(x, y);
var myOptions = {
zoom:8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("googleMap"), myOptions);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(x, y),
map: map,
title: com
});
var infowindow = new google.maps.InfoWindow({
content: com
});
infowindow.open(map, marker);
google.maps.event.addDomListener(window, 'load');
} else {
res.innerHTML = "Enter correct Details: " + status;
}
});
});
});
Manish Kumar ChoudharyPosted Mar 24, 2015, 2:50 AM
Joginder BangerPosted Mar 24, 2015, 3:11 AM
venky nPosted Mar 24, 2015, 3:09 AM
Manish Kumar ChoudharyPosted Mar 24, 2015, 3:02 AM
venky nPosted Mar 24, 2015, 3:00 AM