1

I can't update my Asp:Repeater

<asp:repeater when it's inside in JavaScript code.
<script type="text/javascript">
var markers = [
<asp:Repeater ID="rptMarkers" runat="server">
<ItemTemplate>
        {
        "title": '<%# Eval("Name") %>',
        "lat": '<%# Eval("Latitude") %>',
        "lng": '<%# Eval("Longitude") %>',
        "description": '<%# Eval("Description") %>'
    }
</ItemTemplate>
<SeparatorTemplate>
,
</SeparatorTemplate>
</asp:Repeater>
];
</script>

When i update my page by a UpdatePanel, the asp:repeater not update. It gets the old information.

My call on back side (C#):

<---------
    //JAVASCRIPT
    rptMarkers.DataSource = dt;
    rptMarkers.DataBind();

    UpdMapa.Update();

----->

The UpdMapa not refresh the rptMarkers Tranks.

  • Possible duplicate of [Running Javascript after update panel refresh](http://stackoverflow.com/questions/7844061/running-javascript-after-update-panel-refresh) – Tyler Roper Mar 15 '17 at 17:48
  • Interesting use of a `Repeater`. But you will have to call the javascript function that uses `markers` again after UpdatePanel` update. – VDWWD Mar 15 '17 at 17:49
  • I can fix my problem with this example. – Dhein Jonas Mar 15 '17 at 17:52
  • Yes VDWWD, my callback: UpdMapa.Update(); ScriptManager.RegisterStartupScript(this.UpdMapa, this.GetType(), "carga", "carga();", true). But don't works – Dhein Jonas Mar 15 '17 at 18:24
  • `rptMarkers.DataSource = dt;` is C#. Not JavaScript. That's not how the web works. That code is only going to run server side. – mason Mar 15 '17 at 19:07

0 Answers0