This is a migrated thread and some comments may be shown as answers.

RadMap refreshing shape layer in ajaxpanel

4 Answers 181 Views
Map
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 23 May 2015, 12:57 PM

Hi

 The problem I am having is that when I put a RadAjaxPanel around my RadMap a postback to update the RadClientDataSource needs to be clicked twice in order for the select  url to be called. It works fine if I remove the ajax panel. 

 

<telerik:RadAjaxPanel runat="server">
  <telerik:RadTabStrip ID="connectionsTabStrip" runat="server" MultiPageID="connectionsMultiPage">
  <Tabs>
    <telerik:RadTab Text="Map" PageViewID="mapPageView" />
  </Tabs>
  </telerik:RadTabStrip>
                      
  <telerik:RadMultiPage ID="connectionsMultiPage" runat="server">
    <telerik:RadPageView ID="mapPageView" runat="server">
      <telerik:RadClientDataSource runat="server" ID="tripDataSource" AutoSync="true">
        <DataSource>
          <WebServiceDataSourceSettings ServiceType="GeoJSON" />
        </DataSource>
      </telerik:RadClientDataSource>
  
      <telerik:RadButton ID="button" runat="server" Text="View" OnClick="button_Click" />
      <telerik:RadMap runat="server" ID="tripMap">
        <LayersCollection>
          <telerik:MapLayer></telerik:MapLayer>
          <telerik:MapLayer Type="Shape" ClientDataSourceID="tripDataSource">                  
            <StyleSettings>
              <StrokeSettings Color="#ffffff" Width="10" />
            </StyleSettings>
          </telerik:MapLayer>
        </LayersCollection>
        <DataBindings>
          <MarkerBinding
            DataShapeField="shape"
            DataTitleField="title"
            DataLocationLatitudeField="locationLatitude"
            DataLocationLongitudeField="locationLongitude"
            DataTooltipTemplateField="tooltipTemplate" />
          </DataBindings>
          <CenterSettings  Latitude="-32.962926"  Longitude="151.699727"/>
        </telerik:RadMap>
      </telerik:RadPageView>
    </telerik:RadMultiPage>
  </div>
  <uc1:ExceptionArea runat="server" ID="ExceptionArea" />
</telerik:RadAjaxPanel>

I have some code behind on the button click "button_Click"

tripDataSource.DataSource.WebServiceDataSourceSettings.Select.Url = "/Data/GetJsonTrip.aspx";
tripDataSource.DataBind();
 
tripMap.DataSource = GetMarkers();
tripMap.DataBind();
 

 If I put a break point in GetJsonTrip.aspx I can see it only gets called, on the first click, but does get called on every click after that.

 If I set WebServiceDataSourceSettings.Select.Url in a partial post back, why does the indicated URL not get called after the first postback?

 

Thanks for any help

Matt

 

 

 

 

4 Answers, 1 is accepted

Sort by
0
Matthew
Top achievements
Rank 1
answered on 23 May 2015, 12:59 PM

Sorry I meant to say...

If I put a break point in GetJsonTrip.aspx I can see it doesn't get called on the first click, but does get called on every click after that.

Thanks
Matt

 

 

0
Matthew
Top achievements
Rank 1
answered on 24 May 2015, 03:32 AM

Some further details.

 The GetJsonTrip.aspx is not called after the first postback. It is called after subsequent post backs but will be using the previous postbacks URL value.

It seems to be something like, setting the Select.Url on the datasource in an onclick event is too late for the map to be updated, and its not until the next page load that it looks at the new URL.

0
Accepted
Ianko
Telerik team
answered on 27 May 2015, 11:22 AM
Hello Matthew,

The described matter here is already discussed in a support ticket sent to us (ID 938403). If there are any further questions on the case, let us discuss them there.

For anyone else, the suggested approach is to use the client-side API of RadClientDataSoure to either control and refresh data, or get the Kendo DataSource object to modify directly the widget empowering the control.

Example:
var kendoDataSource = $find("<%= RadClientDataSource1.ClientID %>").get_dataSourceObject();
 
kendoDataSource.transport.options.read.url = "GetJsonTrip.aspx?t=77776666&sd=2015-05-23+00%3a00%3a00&ed=2015-05-24+00%3a00%3a00"
kendoDataSource.read();

Regards,
Ianko
Telerik
0
Matthew
Top achievements
Rank 1
answered on 27 May 2015, 11:49 AM

Thanks Lanko, this worked just fine.

Cheers
Matt

Tags
Map
Asked by
Matthew
Top achievements
Rank 1
Answers by
Matthew
Top achievements
Rank 1
Ianko
Telerik team
Share this question
or