5
Answers

How to use javascript two nested master page in asp.net

venky n

venky n

9y
1.1k
1
this coding work normal default page.  But nested master default page is not working


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:


<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js">  </script>
 <script type="text/javascript" src = "http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false" > </script>
 <script type="text/javascript" src="JScript.js"> </script>

 </script>
 <div>
        <table>
            <tr> <td >
                <asp:Label ID="Label1" runat="server" Text="City :"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddcity" runat="server" AutoPostBack="true"
                        OnSelectedIndexChanged="ddcity_SelectedIndexChanged" >
                    </asp:DropDownList></td>
</tr>
</table></div>
 <div id="googleMap" style="height: 500px; width: 500px">
    </div>
</asp:Content>






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;
                    }
                });
            });
        });


Answers (5)