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); }