Click here to Skip to main content
15,898,222 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Question regarding asp.net web forms Pin
Afzaal Ahmad Zeeshan8-Jun-17 5:49
professionalAfzaal Ahmad Zeeshan8-Jun-17 5:49 
GeneralRe: Question regarding asp.net web forms Pin
ZurdoDev8-Jun-17 5:53
professionalZurdoDev8-Jun-17 5:53 
GeneralRe: Question regarding asp.net web forms Pin
Member 1324809013-Jun-17 1:13
Member 1324809013-Jun-17 1:13 
QuestionObjectDataSource Pin
pollilop7-Jun-17 5:10
pollilop7-Jun-17 5:10 
AnswerRe: ObjectDataSource Pin
Richard Deeming7-Jun-17 6:12
mveRichard Deeming7-Jun-17 6:12 
GeneralRe: ObjectDataSource Pin
pollilop11-Jun-17 22:35
pollilop11-Jun-17 22:35 
SuggestionRe: ObjectDataSource Pin
Yoqueuris13-Jun-17 5:04
Yoqueuris13-Jun-17 5:04 
Questioni have writen c# code to render google map from server side at runtime. but when i execute this code, map is not getting displayed on browser. can any one please tell me what is a error or what changes i need to do. Pin
Member 107737173-Jun-17 20:32
Member 107737173-Jun-17 20:32 
C# code

protected void Page_Load(object sender, EventArgs e)
        {
            string markers = GetMarkers();
            string map = @"
<script type='text/javascript' src='http://maps.googleapis.com/maps/api/js?sensor=false&key=keyvalue'></script>
<script type='text/javascript'>
function initialize() {

var mapOptions = {
center: new google.maps.LatLng(28.3213, 77.5435),
zoom: 2,
mapTypeId: google.maps.MapTypeId.ROADMAP
};

var myMap = new google.maps.Map(document.getElementById('mapArea'),
mapOptions);" + markers + @"}
</script>
";

            Page.ClientScript.RegisterStartupScript(this.GetType(), "initialize", map, false);
        }



        protected string GetMarkers()
        {
            string markers = "";
            SqlConnection conn = new SqlConnection();
            conn.ConnectionString =ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
            {
                SqlCommand cmd = new SqlCommand("SELECT Latitude, Longitude, RegistrationNumber FROM DriverLocation", conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                int i = 0;

                while (reader.Read())
                {
                    i++;
                    markers +=
                    @"var marker" + i.ToString() + @" = new google.maps.Marker({
position: new google.maps.LatLng(" + reader["Latitude"].ToString() + ", " +
                    reader["Longitude"].ToString() + ")," +
                    @"map: myMap,
title:'" + reader["RegistrationNumber"].ToString() + "'});";
                }
            }
            return markers;
        }
    }



html code

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div id="mapArea" style="width: 500px; height: 500px;">
</div>
</form>
</body>
</html>
AnswerRe: i have writen c# code to render google map from server side at runtime. but when i execute this code, map is not getting displayed on browser. can any one please tell me what is a error or what changes i need to do. Pin
Richard Deeming5-Jun-17 8:37
mveRichard Deeming5-Jun-17 8:37 
QuestionUsing Base Model in Shared View Pin
Farhad Eft2-Jun-17 23:16
Farhad Eft2-Jun-17 23:16 
AnswerRe: Using Base Model in Shared View Pin
User 41802543-Jun-17 3:40
User 41802543-Jun-17 3:40 
GeneralRe: Using Base Model in Shared View Pin
Farhad Eft3-Jun-17 5:39
Farhad Eft3-Jun-17 5:39 
QuestionHow codeproject registration page showing client timezone as selected in dropdown Pin
Mou_kol2-Jun-17 0:07
Mou_kol2-Jun-17 0:07 
AnswerRe: How codeproject registration page showing client timezone as selected in dropdown Pin
Richard Deeming2-Jun-17 1:14
mveRichard Deeming2-Jun-17 1:14 
GeneralRe: How codeproject registration page showing client timezone as selected in dropdown Pin
Mou_kol2-Jun-17 2:29
Mou_kol2-Jun-17 2:29 
QuestionNeed some help in binding DataTable that's returning from Web Api with an Html table using jquery Pin
indian14330-May-17 8:08
indian14330-May-17 8:08 
Questiontrouble sending message to the view from controller Pin
Hamiltonian1327-May-17 22:40
Hamiltonian1327-May-17 22:40 
AnswerRe: trouble sending message to the view from controller Pin
F-ES Sitecore29-May-17 22:47
professionalF-ES Sitecore29-May-17 22:47 
GeneralRe: trouble sending message to the view from controller Pin
Hamiltonian1330-May-17 7:23
Hamiltonian1330-May-17 7:23 
GeneralRe: trouble sending message to the view from controller Pin
F-ES Sitecore30-May-17 22:13
professionalF-ES Sitecore30-May-17 22:13 
AnswerRe: trouble sending message to the view from controller Pin
John C Rayan31-May-17 1:56
professionalJohn C Rayan31-May-17 1:56 
GeneralRe: trouble sending message to the view from controller Pin
Hamiltonian1331-May-17 9:16
Hamiltonian1331-May-17 9:16 
GeneralRe: trouble sending message to the view from controller Pin
John C Rayan31-May-17 22:17
professionalJohn C Rayan31-May-17 22:17 
GeneralRe: trouble sending message to the view from controller Pin
F-ES Sitecore1-Jun-17 0:41
professionalF-ES Sitecore1-Jun-17 0:41 
GeneralRe: trouble sending message to the view from controller Pin
John C Rayan1-Jun-17 22:05
professionalJohn C Rayan1-Jun-17 22:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.