Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass function an array from Page_Load

Status
Not open for further replies.

tc3596

Technical User
Mar 16, 2001
283
0
0
Here's my situation. I am trying to create a chart and display it on a web page. I found some code that does all of this for me using javascript. Unfortunately, the example hard codes the array values (chart is actualy a gantt chart). As a matter of fact, all the examples hard code the data, which is completely useless.

On Page_Load in ASP.net, I connect to sql server and get back a recordset already in array form. Now, I just need that information passed to the javascript function.

The page has no forms and all (most) of the javascript code lies in the body of the page.

I was reading about how I may need a master page and then post back the data to the page with the javascript, but I don't know how to do this.


I would also be happy connecting to the database via javascript.

Any thoughts or insight is appreciated.

 
I would also be happy connecting to the database via javascript.

A lot of people would be happy to do this - especially hackers - which is one of the reasons it's impossible.



--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
There is a reason why layers exist, both physical and logical. Rather than fight against this and cram everything into one layer, utilize each layer to it's advantage.

I would approach your scenario this way:
1. create the data access to code to load the data
2. create a service that returns the json representation of the data
3. have the js call the service and pass the json to the chart.

I abandoned webforms awhile ago,but I know there are some ways(hacks) to feed json from the code behind to the page. Rick Strahl is a good source for rich webforms development. I'm sure there is enough content on his site to piece together what you need.


Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top