Asp.net calls 51 DITU

Source: Internet
Author: User

Front-end:

<% @ Page Language = "C #" autoeventwireup = "true" codefile = "mapsdemo. 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 id = "head1" runat = "server">
<Title> my 51 maps </title>

<SCRIPT type = "text/JavaScript" src = "http://api.51ditu.com/js/maps.js"> </SCRIPT>

<SCRIPT type = "text/JavaScript" src = "http://api.51ditu.com/js/ezmarker.js"> </SCRIPT>

<SCRIPT type = "text/JavaScript">
Function onload ()
{
VaR coordinates = Document. getelementbyid ("hidaddress"). value. Split (",");
VaR maps = new ltmaps ("mapdiv ");
VaR point = new ltpoint (coordinates [0], coordinates [1]);
Maps. centerandzoom (New ltpoint (coordinates [0], coordinates [1]), coordinates [2]);
Var control = new ltstandmapcontrol ();
Maps. addcontrol (control );
VaR marker = new ltmarker (point );
Maps. addoverlay (Marker );
}
</SCRIPT>

</Head>
<Body>
<Form ID = "form1" runat = "server">
<Input id = "hidaddress" runat = "server" type = "hidden"/>
* Tip: use it on a map

The approximate position is marked. The result may be inaccurate and is for reference only.

<SCRIPT type = "text/JavaScript">
Function setmap (point, zoom)
{
Document. getelementbyid ("longpolling"). value = point. getlongpolling ();
Document. getelementbyid ("latitude"). value = point. getlatitude ();
Document. getelementbyid ("level"). value = zoom;
Document. form1.submit ();
}
VaR EZ = new ltezmarker ("ezmarker ");
VaR coordinates = Document. getelementbyid ("hidaddress"). value. Split (",");
VaR point = new ltpoint (coordinates [0], coordinates [1]);
EZ. setvalue (point, parseint (coordinates [2]);
Ltevent. addlistener (EZ, "Mark", setmap );
</SCRIPT>

<Input runat = "server" type = "hidden" id = "longpolling" name = "longpolling"/>
<Input runat = "server" type = "hidden" id = "latitude" name = "latitude"/>
<Input runat = "server" type = "hidden" id = "level" name = "level"/>
<Br/>
<Div id = "mapdiv" style = "width: 600px; Height: 400px;">
</Div>

<SCRIPT type = "text/JavaScript">
Onload ();
</SCRIPT>

</Form>
</Body>
</Html>
Background:

Using system;
Using system. configuration;
Using system. Data;
Using system. LINQ;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. htmlcontrols;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. xml. LINQ;

Public partial class _ default: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{
String address = NULL;
If (! Ispostback)
{
Address = "12085627,3201350, 3"; // read database coordinates
This. hidaddress. value = address;
}
Else
{
String addressupdate = This. longpolling. Value + "," + this. Latitude. Value + "," + this. level. value;
Address = addressupdate; // update database coordinates
This. hidaddress. value = address;
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.