trying to build a page of charts (asp control objects) that are smallish and then when we click on the image, a styled jquery modal/dialog pops up that displays a larger version of the chart. i'm trying to accomplish this by doing the following, but my modal is appearing blank.
My code behind 'Enlarge' function is getting called (and when i debug, Popup is getting set with Chart1's values). I'm guessing my update panel is wrong? I'm going to move the charts over to a custom control when this is done, but is there maybe a better way of doing this without returning 'ok' to 'myhide'?
.aspx
<div class="chart-div" onclick="JScript_EnlargeChart('Chart1')">
<asp:chart id="Chart1" runat="server"></asp:chart>
</div>
<div id="PopUp">
<form runat="server" id="form1">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Chart runat="server" ID="PopUpChart"></asp:Chart>
</ContentTemplate>
</asp:UpdatePanel>
</form>
<span id="myhide" style="display:none"></span>
</div>
javascript
<script type="text/jscript">
$(document).ready(function () {
$('#PopUp').hide(); //hide on startup
});
function JScript_EnlargeChart(x) { //ajax call to create a dialog box to enlarge a given chart
$('#myhide').load('mypage.aspx?Enlarge=' + x); //refresh
$('#PopUp').modal({ //do popup
title: 'Enlarged Chart',
height: 400,
width: 700,
buttons: {
'Close': function (win) { win.closeModal(); }
}
});
};
</script>
code behind
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsNothing(Request.QueryString("Enlarge")) Then
Response.Write(Enlarge(Request.QueryString("Enlarge")))
Response.Flush()
Response.End()
Else
GenerateCharts()
End If
End Sub
Function Enlarge(ByVal chartid As String) As String
If chartid = "Chart1" Then
PopUpChart = Chart1
PopUpChart.Width = 412
PopUpChart.Height = 296
UpdatePanel1.Update()
ElseIf chartid = "Chart2" Then
PopUpChart = Chart2
UpdatePanel1.Update()
End If
Return "OK"
End Function