Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Call 1° Server Function, 2° JavaScript Function inside UpdatePanel

$
0
0

Hi guys,

I have an asp button that calls a function that creates a dataset from a query and fills a GridView, then it saves that DataSet into a session. All ok here, but when I try to trigger the JavaScript function it just does nothing. Here is my code, Im trying the ScripManager.RegisterStartupScript and nothing happens.

ASPX - JavaScript

<script type="text/javascript" language="javascript">
   function evtCreateChartLoyalty(){$get("upProgess").style.display = 'block';
      PageMethods.returnChartLoyalty($get("<%=ddlSearchTypeLoyalty.ClientID %>").value, "Current", "Previous", "Loyalty (Time, Country & Regions)" , $get("<%=ddlSearchTypeLoyalty.ClientID %>").value, "Loyal Users", OnSucceededLoyalty, OnFailedLoyalty);
   }
   function OnSucceededLoyalty(result) {
      var aChart = new FusionCharts("../swf/MSLine.swf","idChartLoyalty","1300","800","0","0");
      aChart.setDataXML(result);
      aChart.render("divVsMonthlyCountry");$get("upProgess").style.display = 'none';$get("btnExportarVersusMesesPaisHTML").style.display = '';
   }
   function OnFailedLoyalty(error) {            
      alert("Stack Trace: " + error.get_stackTrace() + "\r\n" + "Error: " + error.get_message() + "\r\n" + "Status Code: " + error.get_statusCode() + "\r\n" + "Exception Type: " + error.get_exceptionType() + "\r\n" + "Timed Out: " + error.get_timedOut()); $get("upProgess").style.display = 'none';
   }</script>

ASPX - .NET

<asp:UpdatePanel ID="upGenerarLoyalty" runat="server"><ContentTemplate><asp:Button ID="btnGenerarLoyaltyTRS" runat="server" Text="Generar" OnClick="btnGenerarLoyaltyTRS_Click" /></ContentTemplate></asp:UpdatePanel>

CS

protected void btnGenerarLoyaltyTRS_Click(object sender, EventArgs e)
{
    //a lot of code and dsActual have data
grdLoyaltyTRS.DataSource = Session["xpressLoyaltyReport"] = dsActual; grdLoyaltyTRS.DataBind(); ScriptManager.RegisterStartupScript(upGenerarLoyalty, this.GetType(), "MyChart", "evtCreateChartLoyalty", true); }



Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>