Code Behind for showing a graphic(Icon) on a particular the location .

2384
1
08-18-2015 10:04 AM
JulieBiju
Occasional Contributor

Dear Friends,

I just started to move technology of my web application from silverlight to Javascript API.

I wanted to do only map display in Java. rest all code need to write with vb.net. Any samples  available for that?

Pls see my design code below.Here map display working perfect

When I click show report button, The map should zoom to a particular location for Eg long: 52.899, Lat :23.444

How to write code behind in vb.net for adding a graphic icon on a particular location? Can anyone hwlp me?

Default.aspx design page code below

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" 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>Mapping</title>

 

    <style type="text/css">

        .auto-style2 {

            width: 260px;

            height: 100%;

        }

        .auto-style3 {

            width: 100%;

            height: 100%;

        }

    </style>

  

</head>  

<body  style="background-image: url('Images/menubackground.png');"  >

<form id="form2" runat="server">

    <div style="width: 100%; height: 100%">

                <table id="Tablecontrols0"   style="font-size: 15px; z-index: 101;

            background-color: #5B748B; width: 100%; height: 100%;">

            <tr style="font-family: Times New Roman">

                <td style="border-style: none; background-color: #496277; height: 2%;"

                    valign="top" class="auto-style2" >

             

                     </td>

              

                <td align="left"   style="border-style: none; background-color: #496277; height: 2%;"

                    valign="top" class="auto-style3" >

             

                     </td>

              

            </tr>

            <tr style="font-family: Times New Roman">

                <td style="border-style: none;"

                    valign="top" bgcolor="#496277"  >

             

                    <table id="Tablecontrols"   style="border-color: #F2F0EE; font-size: 15px; z-index: 101;

            background-color: #496277; width:auto; height: 274px; font-family: verdana; color: tomato; font-weight: bold; border-top-style: none;" align="left">

           

          

             

        

            <tr style="font-family: Times New Roman">

                <td

                    colspan="2" rowspan="1" style="border-width: 2px; font-weight: bold;  position: static;

                    height: 24px; text-align: center; border-top-color: #547289; border-bottom-color: #547289; border-top-style: solid; border-bottom-style: solid;" valign="top" align="left">

                    <br />

                    <asp:LinkButton ID="LnkLastPosition" runat="server" Font-Bold="True"

                        Font-Names="Verdana" Font-Size="11pt" Height="21px" Style="text-align: center; font-size: 15px;"

                        ToolTip="Click here for Viewing Reports" Width="153px" Font-Italic="False" Font-Underline="False" ForeColor="Black" BackColor="#F2F0EE" BorderStyle="Solid" BorderWidth="1px">Show Report</asp:LinkButton>

                    <br />

                    <br />

                </td>

               

            </tr>

            <tr style="font-family: Times New Roman">

                <td

                    colspan="2" style="font-weight: bold;  position: static;

                    height: 24px; text-align: center; border-top-color: #F2F0EE; border-bottom-color: #F2F0EE;" valign="top" align="center">

                     </td>

               

            </tr>

        </table>

     

                </td>

              

                <td style="border-style: none; background-color: transparent; background-image: url('Images/menubackground.png');"

                    valign="top" id="td11" >

             

                   <html>

  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <!--The viewport meta tag is used to improve the presentation and behavior of the samples

      on iOS devices-->

    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">

    <title>Create Map and add a dynamic layer</title>

    <link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css"/>

    <style>

      html, body, #mapDiv{

        padding: 0;

        margin: 0;

        height: 100%;

      }

    </style>

    <script src="http://js.arcgis.com/3.14/"></script>

    <script>

        var map;

        require([

          "esri/map",

          "esri/layers/ArcGISDynamicMapServiceLayer",

          "esri/layers/ImageParameters"

        ], function (

          Map, ArcGISDynamicMapServiceLayer, ImageParameters) {

            map = new Map("mapDiv", {

                sliderOrientation: "horizontal"

            });

            var imageParameters = new ImageParameters();

            imageParameters.format = "jpeg"; //set the image type to PNG24, note default is PNG8.

            //Takes a URL to a non cached map service.

            var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapSer...", {

                "opacity": 0.5,

                "imageParameters": imageParameters

            });

            map.addLayer(dynamicMapServiceLayer);

        });

    </script>

  </head>

  <body>

    <div id="mapDiv">    </div>

  </body>

</html>

          </td>

              

            </tr>

            </table>

     

     </div>

        </form>

</body>

</html>

0 Kudos
1 Reply
JulieBiju
Occasional Contributor

Hi All,

Can anyone help me to solve the issue?I dont know anything about Java. Silverlight issues pushing me to go with Javascript API. Without help I cannot move.

I added the Dynamic map through javascript API successfully. I would like to write all other code in vb.net. For that I am trying the code behind like below

Imports ESRI.ArcGIS.Client

Partial Class Default2

    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

         Dim displayExtent As New ESRI.ArcGIS.Client.Geometry.Envelope(23, 34, 33, 44)

        DynamicMapServiceLayer.ZoomTo(displayExtent)

    End Sub

End Class

Here I am getting error like below. How can I solve this?

Error    11    Reference required to assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' containing the base class 'System.Windows.DependencyObject'. Add one to your project. 

My Default.aspx page design below

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head id="Head1" runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

            <asp:Button ID="Button1" runat="server" Text="Button" />

        </div>

    </form>

</body>

</html>

<html>

  <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <!--The viewport meta tag is used to improve the presentation and behavior of the samples

      on iOS devices-->

    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">

    <title>Create Map and add a dynamic layer</title>

    <link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css"/>

    <style>

      html, body, #mapDiv{

        padding: 0;

        margin: 0;

        height: 100%;

      }

    </style>

    <script src="http://js.arcgis.com/3.14/"></script>

    <script>

        var map;

        require([

          "esri/map",

          "esri/layers/ArcGISDynamicMapServiceLayer",

          "esri/layers/ImageParameters"

        ], function (

          Map, ArcGISDynamicMapServiceLayer, ImageParameters) {

            map = new Map("mapDiv", {

                sliderOrientation: "horizontal"

            });

            var imageParameters = new ImageParameters();

            imageParameters.format = "jpeg"; //set the image type to PNG24, note default is PNG8.

            //Takes a URL to a non cached map service.

            var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapSer...", {

                "opacity": 0.5,

                "imageParameters": imageParameters

            });

            map.addLayer(dynamicMapServiceLayer);

        });

    </script>

  </head>

  <body>

    <div id="mapDiv"></div>

  </body>

</html>

0 Kudos