Generate HTML and give it back to client

  • Thread starter Thread starter Barbiturico76
  • Start date Start date
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.
 
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.
 
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.
 
Back
Top