This is a fairly newbie question I'm sure. I'm looking at replacing our server side charting library with the open source javascript library 'flot'. I can use ASP in the javascript used to call the library as per the following example
<div id="placeholder" style="width: 600px; height: 300px;">
</div>
<script type="text/javascript">
$(function () {
var d = [<%
for (var i = 0; i < 10; i++) {
if(i > 1)
Response.Write(",");
Response.Write("[" + i + "," + Math.Sin(i) + "]");
}%>];
$.plot($("#placeholder"), [d]);
});
</script>
This works a charm but what I really need to do is display data from a method in my code behind file (and ultimately a database). A quick Google suggests that I need to use AJAX to accomplish this but I would like to do it on page load.
It strikes me as something that should be simple to do but then I am relatively new to web development (I'm a windows forms developer by trade and an MS Certified one at that so I know my way around C#).
Any help or pointers would be greatly appreciated.
Cheers,
Neil.