Dynamic Graphics.

N

ng5000

Hi,

I'm new to ASP.Net (first looked at it 2 days ago). All I want to do
is create a user's web page that displays data from a database in the
form of a bespoke display (e.g picture of a computer with a temp guage
on the monitor).

I've got lots of ADO.Net experience so I was able to create the
database side very quickly. I now have a web page that displays the
data as text.

I'd like to use the standard .Net graphics drawing classes for image
creation (or even my own images). How can I update the user's page
without causing a refresh? I.e. I might only want to change the colour
of a LED on the screen.

Any help greatly apreciated.

Thanks,

Nick
 
K

Kevin Spencer

Hi Nick,

An HTML document (which is what an ASPX page is on the client) has no images
*in* it, but references *to* images that are fetched by the browser via
their URLs. So, the first thing you have to do is implement a page or
HttpHandler that can send an image in response to an HttpRequest. This can
fairly easily be done with an ASPX page that sets the Response.ContentType
property to "image/jpg" (or another image MIME type) and binarily writes the
image to the Response.OutputStream.

It can be done using a single ASPX page that takes information from the
URL's QueryString to determine what sort of an image to return.

In order to have the image update, the browser must make a new request for
the image. The tricky part here is that the browser caches images, so you
should append something to the QueryString to make the URL slightly
different with each Request. After that, you can use JavaScript on the
client, or PostBacks to refresh the image (or even Ajax if you're brave!).

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A brute awe as you,
a Metallic hag entity, eat us.
 
G

Guest

Hello Nick,

I understand your question to be about placing something like a progress bar
on an web page and updating it without refreshing the entire page. Simple
answer is that with traditional web pages, it is difficult/not possible to
do, due to the way http works. Http has been a page-oriented, stateless
protocol. However with the introduction of AJAX (Asynchronous Javascript and
XML), that is changing but it is still in the early stages. You can find
articles around which can help you -
http://www.google.com/search?hl=en&q=ajax+progress+bar.
 

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

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,076
Latest member
OrderKetoBeez

Latest Threads

Top