I would recommend using the SqlGeospatialDataReader from the codebehind for reading shapes. The API of the SqlGeospatialDataReader allows to do it using the SqlGeospatialDataReader.Read method. You can start it when the data is already retrieved from database. You can use the SqlGeospatialDataReader.PreviewReadCompleted
event to get the generated shapes.
The SqlGeospatialDataReader reads data asynchronously, but you should have the ItemsRequestEventArgs object of ItemsRequest to invoke the CompleteItemsRequest method.
Unfortunately the SqlGeospatialDataReader does not support an object like the "UserState" for asyncronous operations. We have created a PITS issue to implement this feature in future releases. You can track implementation of it using the following link:
Currently to resolve this problem you should create a reference between SqlGeospatialDataReader instance and ItemsRequestEventArgs. I think for this purpose you can use a dictionary like the following:
public class DynamicSource : IMapDynamicSource
, ItemsRequestEventArgs> pendingRequests = new Dictionary<
public void ItemsRequest(object sender, ItemsRequestEventArgs e)
var reader = new SqlGeospatialDataReader();
reader.PreviewReadCompleted += new PreviewReadShapesCompletedEventHandler(reader_PreviewReadCompleted);
private void reader_PreviewReadCompleted(object sender, PreviewReadShapesCompletedEventArgs eventArgs)
if (eventArgs.Error == null)
ItemsRequestEventArgs e = this.pendingRequests[sender];
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>