Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8499849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:46:45+00:00 2026-06-11T00:46:45+00:00

I am in the initial stages in working with java script and I just

  • 0

I am in the initial stages in working with java script and I just wrote a small application in asp.net for using the Google Maps APIv3. I want to display the map in a panel. This is the code that I wrote but I have problem in binding the java script with the Panel’s OnLoad event:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head runat="server">
  <title>Map Test</title>
    <style type="text/css">
      html{height:100%}
      body{height:100%; margin:0;padding:0}
      #map_can{height:100%}
    </style>
  <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzawerwerQ55N500rxxxxdPNvMoQ74aRYO30Wo&sensor=true">
  </script>
  <script type="text/javascript">
     function init()
     {
       var mapoptions=
          {
            center: new google.maps.LatLng(17.379064211298, 78.478946685791),
            zoom:8,
            mapTypeId: google.maps.MapTypeId.ROADMAP
          };
       var map=new  google.maps.Map(document.getElementById("map_can"),mapoptions);
     }
  </script>
</head>
<body>
  <form id="form1" runat="server">
    <asp:Panel  OnLoad="init()" ID="Panel1" runat="server" 
      style="z-index: 1; left: 37px; top: 59px; position: absolute; height: 273px; width: 565px">
      <div id="map_can" style="width:100%; height:100%"></div>
    </asp:Panel>
  </form>
</body>
</html>

Error: ASP.default_aspx' does not contain a definition for 'init'

I guess I am binding it the wrong way. Suggestions please.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:46:46+00:00Added an answer on June 11, 2026 at 12:46 am

    The Panel OnLoad property is for setting server side handler for Load event (it should be method in your page class).

    There is no way of setting client side load event on Panel control as it generates DIV element (and DIV element doesn’t support load event).

    A primitive way out of this is to use client side load event of BODY element:

    <body onload="init();" >
        ...
    </body>
    

    But a lot better way is to wait for DOM readiness to invoke a function. An easy and cross browser way of doing this is usage of library like jQuery:

    <script type="text/javascript">
        $(document).ready(function() {
            var mapoptions = {
                center: new google.maps.LatLng(17.379064211298, 78.478946685791),
                zoom: 8,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new  google.maps.Map(document.getElementById("map_can"),mapoptions);  
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am in the initial stages of working on the design for an application.
I am working on a web application(using PHP) which will use MySQL database in
I am using CakePHP for a web application. And I am in very initial
We're in the initial stages of a large project, and have decided that some
Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my
In my application my initial view controller pushes a UITabBarController modally which has 4
I'm currently working on a new game for iOS using Cocos2D. The game needs
I am working with the scantest of application documentation (shocker), and what there is
I'm in the early stages (read:just started yesterday) of a project, and I'm setting
I'm working in an application that loads a few remote jsons at startup. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.