Документация по Яндекс картам находится по адресу http://api.yandex.ru/maps/
Для примера взята версия API 2.1 beta
- Добавляем в файл 10000_YandexMapModule.config в раздел <featureDefinition></featureDefinition> следующие строки:
<featureSetting
resourceFile="YandexMapResources"
resourceKey="YandexMapPlacemarkDescription"
defaultValue="Офис Яндекса в Москве"
controlType="TextBox"
controlSrc=""
helpKey=""
sortOrder="100"
regexValidationExpression=""
/>
<featureSetting
resourceFile="YandexMapResources"
resourceKey="YandexPlacemarkX"
defaultValue="55.733835"
controlType="TextBox"
controlSrc=""
helpKey=""
sortOrder="110"
regexValidationExpression=""
/>
<featureSetting
resourceFile="YandexMapResources"
resourceKey="YandexPlacemarkY"
defaultValue="37.588227"
controlType="TextBox"
controlSrc=""
helpKey=""
sortOrder="120"
regexValidationExpression=""
Сохраняем

- В файле YandexMapResources.resx добавляем следующие строки:
YandexMapPlacemarkDescription
|
Placemark Description
|
YandexPlacemarkX
|
Placemark X
|
YandexPlacemarkY
|
Placemark Y
|
Сохраняем.

- В файле YandexMapModule.ascx.cs
- объявляем переменные
private string placemarkDescription = "Офис Яндекса в Москве";
public string placemarkX = "55.733835";
public string placemarkY = "37.588227";

- получаем значения объявленных переменных из настроек, добавив следующие строки
if (Settings.Contains("YandexMapPlacemarkDescription"))
{
placemarkDescription = Settings["YandexMapPlacemarkDescription"].ToString();
}
if (Settings.Contains("YandexPlacemarkX"))
{
placemarkX = Settings["YandexPlacemarkX"].ToString();
}
if (Settings.Contains("YandexPlacemarkY"))
{
placemarkY = Settings["YandexPlacemarkY"].ToString();
}
после
private void LoadSettings()
{

- Описываем функцию IncludeYandexMapScript()
private void IncludeYandexMapScript()
{
Page.ClientScript.RegisterClientScriptBlock(
typeof(Page),
"ymapin", "\n<script src=\"http://api-maps.yandex.ru/2.1-dev/?lang=ru-RU&load=package.full\" type=\"text/javascript\"></script>");
String scriptText = "";
scriptText = "\n<script type=\"text/javascript\">ymaps.ready(function () {var myMap = new ymaps.Map('YMapsID', {center: [";
scriptText += placemarkX;
scriptText += ",";
scriptText += placemarkY;
scriptText += "],zoom: 12});";
scriptText += "var myPlacemark = new ymaps.Placemark(myMap.getCenter(), {balloonContentBody: ['";
scriptText += placemarkDescription;
scriptText += "'].join('')}, {preset: 'islands#redDotIcon'});myMap.geoObjects.add(myPlacemark);});</script>";
Page.ClientScript.RegisterClientScriptBlock(typeof(Page),"ymap", scriptText);
}
- и добавляем её в LoadSettings() после
placemarkY = Settings["YandexPlacemarkY"].ToString();
}
внеся следующую строку
IncludeYandexMapScript();
Сохраняем.

- В файле YandexMapModule.ascx меняем строку
<div class="settingrow">
This will soon be the entry point to the YandexMap.<br />
</div>
на
<div id="YMapsID" style="width:400px; height:300px"></div>
Сохраняем.

- Запускаем построение приложения YandexMap.Web.UI
- В браузере запускаем установку /Setup/Default.aspx

Исходный код модуля Yandex карты (доступен после регистрации).
Модуль Yandex карты (доступен после регистрации).