New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

DataSet

TELERIK OFFICES

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>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
</head>
<body>
    <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" />
            <DataBindings>
                <MarkerBinding DataShapeField="Shape" DataTitleField="City" DataLocationLatitudeField="Latitude" DataLocationLongitudeField="Longitude" />
            </DataBindings>
            <LayersCollection>
                <telerik:MapLayer Type="Tile" Subdomains="a,b,c"
                    UrlTemplate="https://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png"
                    Attribution="&copy; <a href='http://osm.org/copyright' title='OpenStreetMap contributors' target='_blank'>OpenStreetMap contributors</a>.">
                </telerik:MapLayer>
            </LayersCollection>
        </telerik:RadMap>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance