473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

HTML and server conversation via ASP.NET

Hi dears,

I have a plain HTML page.

I want to render it a little interactive. I was thinking to add to it 1
script and events to the elements I want to make interactive.

Then, I need to talk with an ASP.NET page which would actually do some
processing on the server. Processing may include a replace
(regeneration) of the above HTML page, for further interaction.

I have imagined the following scheme, but I need your advise to check
whether I am on the right track, or there are better or more elegant
ways to do that. Criticisms, suggestions, opinions are most welcome.

Here is my demo:
PLAIN HTML PAGE (want to add interactivity to some elements)
===============

<html>
<head><title>
Plain HTM page
</title>

<script type="text/javascript" language="JavaScript">
function Clicked(MyControlID)
{
var obj = document.getElementById("Messenger");
obj.value = MyControlID;
document.form1.submit();
}
</script>

</head>
<body>

<div id="Square1" style="width: 50px; height: 50px;
background-color:green" onclick = "Clicked('Square1')"></div>
<div id="Square2" style="width: 50px; height: 50px;
background-color:Red" onclick = "Clicked('Square2')"></div>

<form name="form1" method="get" action="AspProcessor.aspx"
id="form1">
<input type="hidden" name="ClickedElement" id="Messenger" />
</form>

</body>

</html>


ASP.NET PAGE (will process request and replace html)
============
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

If Me.Page.Request.HttpMethod = "GET" Then

Response.Write(Me.Page.Request.QueryString("Clicke dElement") & " was
clicked")

ElseIf Me.Page.Request.HttpMethod = "POST" Then
Response.Write(Me.Page.Request.Form("ClickedElemen t") & "
was clicked")

Else

MsgBox("Unexpected method " & Me.Page.Request.HttpMethod)

End If

End Sub

End Class

Aug 23 '06 #1
2 1907
Having the page as an ASPX page, even if it really is not doing much, is no
a big deal. What you are waiming at here sounds a lot like AJAX. On the
asp.net site, there is a tool called Atlas for including Ajax in your apps.
It is still beta. There is also Ajax.net, an open source implementation.
Essentially, Atlas or Ajax.net use JavaScript to send XML messages back to
the server for the dynamic bits.

Can you go with the plain HTML and a JavaScript submit? Sure, but why should
you have to debug all the infrastructure code, esp. client side which is a
real pain, when you can have that part handled by someone else.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think Outside the Box!
*************************************************
<pa***********@libero.itwrote in message
news:11*********************@m79g2000cwm.googlegro ups.com...
Hi dears,

I have a plain HTML page.

I want to render it a little interactive. I was thinking to add to it 1
script and events to the elements I want to make interactive.

Then, I need to talk with an ASP.NET page which would actually do some
processing on the server. Processing may include a replace
(regeneration) of the above HTML page, for further interaction.

I have imagined the following scheme, but I need your advise to check
whether I am on the right track, or there are better or more elegant
ways to do that. Criticisms, suggestions, opinions are most welcome.

Here is my demo:
PLAIN HTML PAGE (want to add interactivity to some elements)
===============

<html>
<head><title>
Plain HTM page
</title>

<script type="text/javascript" language="JavaScript">
function Clicked(MyControlID)
{
var obj = document.getElementById("Messenger");
obj.value = MyControlID;
document.form1.submit();
}
</script>

</head>
<body>

<div id="Square1" style="width: 50px; height: 50px;
background-color:green" onclick = "Clicked('Square1')"></div>
<div id="Square2" style="width: 50px; height: 50px;
background-color:Red" onclick = "Clicked('Square2')"></div>

<form name="form1" method="get" action="AspProcessor.aspx"
id="form1">
<input type="hidden" name="ClickedElement" id="Messenger" />
</form>

</body>

</html>


ASP.NET PAGE (will process request and replace html)
============
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

If Me.Page.Request.HttpMethod = "GET" Then

Response.Write(Me.Page.Request.QueryString("Clicke dElement") & " was
clicked")

ElseIf Me.Page.Request.HttpMethod = "POST" Then
Response.Write(Me.Page.Request.Form("ClickedElemen t") & "
was clicked")

Else

MsgBox("Unexpected method " & Me.Page.Request.HttpMethod)

End If

End Sub

End Class

Aug 23 '06 #2
Thanks Gregory,

I explain better my contex, so you can focus better your suggestions.

I have a (say "server") application which generates reports in form of
html files. These html file are *extremely* complicated and could not
be done (in practice) as ASP pages. They are generated in no time
through brutal writing on disk of the html code (streamwriter).

Now, one would like to add web interactivity to these html reports. For
instance, when one clicks on a cell a drill down could occur (etc...).
The request could be sent to the server (through the mechanism I
schetcked above) and the html report immediately regenerated to show
the new report (eg, drilled down).

This architecture would have 2 advantages (that i can see now):
1. Html reports can be ported wherever and still be used as plain html
(if does not want to interact)
2. Reports can be very complex in design and are generated at light
speed.

Thanks for any advice or comment

-p

Cowboy (Gregory A. Beamer) ha scritto:
Having the page as an ASPX page, even if it really is not doing much, is no
a big deal. What you are waiming at here sounds a lot like AJAX. On the
asp.net site, there is a tool called Atlas for including Ajax in your apps.
It is still beta. There is also Ajax.net, an open source implementation.
Essentially, Atlas or Ajax.net use JavaScript to send XML messages back to
the server for the dynamic bits.

Can you go with the plain HTML and a JavaScript submit? Sure, but why should
you have to debug all the infrastructure code, esp. client side which is a
real pain, when you can have that part handled by someone else.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think Outside the Box!
*************************************************
<pa***********@libero.itwrote in message
news:11*********************@m79g2000cwm.googlegro ups.com...
Hi dears,

I have a plain HTML page.

I want to render it a little interactive. I was thinking to add to it 1
script and events to the elements I want to make interactive.

Then, I need to talk with an ASP.NET page which would actually do some
processing on the server. Processing may include a replace
(regeneration) of the above HTML page, for further interaction.

I have imagined the following scheme, but I need your advise to check
whether I am on the right track, or there are better or more elegant
ways to do that. Criticisms, suggestions, opinions are most welcome.

Here is my demo:
PLAIN HTML PAGE (want to add interactivity to some elements)
===============

<html>
<head><title>
Plain HTM page
</title>

<script type="text/javascript" language="JavaScript">
function Clicked(MyControlID)
{
var obj = document.getElementById("Messenger");
obj.value = MyControlID;
document.form1.submit();
}
</script>

</head>
<body>

<div id="Square1" style="width: 50px; height: 50px;
background-color:green" onclick = "Clicked('Square1')"></div>
<div id="Square2" style="width: 50px; height: 50px;
background-color:Red" onclick = "Clicked('Square2')"></div>

<form name="form1" method="get" action="AspProcessor.aspx"
id="form1">
<input type="hidden" name="ClickedElement" id="Messenger" />
</form>

</body>

</html>


ASP.NET PAGE (will process request and replace html)
============
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

If Me.Page.Request.HttpMethod = "GET" Then

Response.Write(Me.Page.Request.QueryString("Clicke dElement") & " was
clicked")

ElseIf Me.Page.Request.HttpMethod = "POST" Then
Response.Write(Me.Page.Request.Form("ClickedElemen t") & "
was clicked")

Else

MsgBox("Unexpected method " & Me.Page.Request.HttpMethod)

End If

End Sub

End Class
Aug 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: R Fischer | last post by:
I am trying to redirect output from an FTP conversation using System.Diagnostics.Process. When I running the following code on XP Professional, I get the redirected output from my applications...
4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
7
by: rdh | last post by:
Hi all, I am in process of developing a Server in C++ supporting multiple protocols. The server will be exposing various functionalities, and the clients can communicate over any of the...
4
by: Jonathan (Pickles) Sklan-Willis | last post by:
I need several things in HTML or Javascript. It canNOT be a server side script, it is for a standalone project in HTML ONLY! PAGE 1 is a simple blank page where there will be an on.click so that...
2
by: darin dimitrov | last post by:
Hello, Is there a way to verify that a particular account exists on SMTP server before sending email to it in an ASP.NET web application?
12
by: Ann Marinas | last post by:
Hi all, I would like to ask for some help regarding separating the asp.net webserver and the sql server. I have created an asp.net application for a certain company. Initially, we installed...
4
by: Hul Tytus | last post by:
comp.infosystems.www.authoring.html multiple submits When multiple submit lines are placed in an HTML form, the string returned to the server shows the name=value field for each one with no...
7
by: David | last post by:
i think i just realized i'm an idiot. again. (not syntactically correct code... just pieces to illustrate) class StateObject { members like socket, receiveBuffer, receiveBufferSize,...
6
by: Guy Macon | last post by:
cwdjrxyz wrote: HTML 5 has solved the above probem. See the following web page: HTML 5, one vocabulary, two serializations http://www.w3.org/QA/2008/01/html5-is-html-and-xml.html
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.