I can fix the IE problem as follows by simply using a bit of jQuery. Several possible benefits ...
- This fixes the problem between browsers.
- This is an unobtrusive approach (not mixing javascript and HTML in the view).
- You can refresh the image using ajax.
Create a new file in the scripts folder (for example, "chart.js") that simply attaches an anonymous function to the events of the click of your flags from the documentβs ready function. You will obviously also need to include a script link in your page:
$(document).ready(function () { // Attach a function to the click event of both checkboxes $("#chkXAxisColor,#chkScatter").click(function () { // Make an ajax request and send the current checkbox values. $.ajax({ url: "/Home/RenderCharts", type: "GET", cache: false, data: { XAxisColor: $("#chkXAxisColor").attr("checked"), YAxisColor: $("#chkScatter").attr("checked") }, success: function (result) { alert(result); $("#chart").attr("src", result); } }); }); });
Best of all, you can exclude javascript from your view :)
... <div style="margin: 2px 0 2px 0"> @Html.CheckBox("chkXAxisColor", XAxisColor, new { @Id = "chkXAxisColor" }) X Axis Color @Html.CheckBox("chkYAxisColor", YAxisColor, new { @Id = "chkScatter" }) Y Axis Color </div> ...
This, of course, is a very simple example that fixes the IE problem, but you can get interest from there in terms of how you update the image +, show the boot gif, etc. with only a few lines.
Hope this is the right solution for you!
blins source share