Map - DataSet


Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

RadMap can use the standard data sources for data binding an ASP.NET control:

  • Declarative ASP.NET data sources (SqlDatasource, ObjectDataSource, LinqDataSource, etc.)
  • Server-side objects that implement IEnumerable, IDataSource or the IListSource interface.

The Markers and the Layers of Telerik ASP.NET map are data bound separately.

You can use the DataSourceID property of the markers layer when data binding markers declaratively or the DataSource property when the markers are bound in the code behind.

The data binding of layers is achieved via the LayersDataSourceID and LayersDataSource properties.

The columns of the data source are attached to their corresponding data fields in the markers and layers via the properties with the structure Data[field name]Field declared in the RadMap > DataBindings > MarkerBinding and RadMap > DataBindings > LayerBinding properties.

The ItemDataBound event can be used to customize the data bound objects on the server. The MapItemDataBoundEventArgs argument passed to the handler exposes the created item and the entire data item, to which it is data bound.

You can find more information and examples on data binding a RadMap on the server in the RadMap - Server-side Data Binding help article and details about its server-side API in the RadMap Server-side API article.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • styles.css
<%@ Page Title="" Language="C#"  AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.Map.BindToDataSet.DefaultCS" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns=''>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-auto">
        <h2 class="mapTitle">TELERIK OFFICES</h2>
        <telerik:RadMap RenderMode="Lightweight" runat="server" ID="RadMap1" Zoom="2" CssClass="MyMap" OnItemDataBound="RadMap1_ItemDataBound">
            <CenterSettings Latitude="23" Longitude="10" />
                <MarkerBinding DataShapeField="Shape" DataTitleField="City" DataLocationLatitudeField="Latitude" DataLocationLongitudeField="Longitude" />
                <telerik:MapLayer Type="Tile" Subdomains="a,b,c"
                    UrlTemplate="http://#= subdomain zoom #/#= x #/#= y #.png"
                    Attribution="&copy; <a href='' title='OpenStreetMap contributors' target='_blank'>OpenStreetMap contributors</a>.">

Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?