Generate HTML and give it back to client

B

Barbiturico76

Hi again, another question for you.
In C# WinForms I used to create html and visualizing it in a IE wrapper,
without even create a file on the system. It was very useful.

Is there a way to reproduce the same behaviour in ASP.NET?
I mean, a user send a request of a page with some parameters, my WebApp
elaborates them and gives back a brand new HTML page (no ASP.NET
template, no aspx page behind).

I'm a newbie in WebApplications so forgive me if this is a stupid question.

See you.
 
B

Barbiturico76

Mark Rae [MVP] ha scritto:
I'm not quite sure what you mean... The whole point of ASP.NET is to
create HTML dynamically and stream it to the requesting client browser e.g.

1) Client makes an HttpRequest

2) Server receives the HttpRequest, processes it and generates an
HttpResponse

3) Client receives the HttpResponse in the form of HTML and renders it
to the browser
Example to let me understood:

if I want to programmatically create a page like this one:


//----------------------------------------------------------------------------

<html>
<head>
<script type="text/javascript"
src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["piechart"]});
google.setOnLoadCallback(drawChart); // Set callback to run when
API is loaded
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Task');
data.addColumn('number', 'Hours per Day');
data.addRows(5);
data.setValue(0, 0, 'Work');
....
data.setValue(4, 1, 7);

var chart = new
google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, {width: 400, height: 240, is3D: true, title:
'My Daily Activities'});
}
</script>
</head>

<body>
<div id="chart_div"></div>
</body>
</html>

//----------------------------------------------------------------------------

It uses the Google Visualisation API

The data must be added by the App.
Is it possible?
How?

Thanks a lot.
 
B

Barbiturico76

Mark Rae [MVP] ha scritto:
<snip>

That's little more than a very basic HTML page with some JavaScript -
all you would need to do would be to create a standard aspx page and
drop the JavaScript into its header...


What does that mean? What data? What App are you talking about...?
App is my Web Application.
Data is....

<html>
<head>
<script type="text/javascript"
src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["piechart"]});
google.setOnLoadCallback(drawChart); // Set callback to run when
API is loaded
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Task');
data.addColumn('number', 'Hours per Day');
data.addRows(5);
data.setValue(0, 0, 'Work');
.... <------------- THESE DATA!!!!!
data.setValue(4, 1, 7);

var chart = new
google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, {width: 400, height: 240, is3D: true, title:
'My Daily Activities'});
}
</script>
</head>

<body>
<div id="chart_div"></div>
</body>
</html>





But thanks. Already did it.
I drop the JavaScript into page's header, like you said.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top