Web Form Code Behind Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a aspx page; the server page onLoad will create a basic table with a header row and a couple more rows of data. It's very simple to populate the table at load and display it on the client, however what if i have a thread that is running on the server that is listening for data, when it gets data it needs to re-post the table to the client side. if possible i don't want to re-draw the entire page, just update / re-draw the table

Thanks Eric
 
Hi Eric,

No, I can provide you some code of one of the methods to force that the page
does automaticly a refresh. However what you ask is sending an unasked page
to a client, what is in my opinion not possible.

Cor
 
Hi Eric,

You are not the first who ask this, it does not say much, however I have
never seen an answer on this question, and I can assure you that when I see
it, than I remember this one.

Cor
 
In the pre .net days you could make an Active X control, this control could have code that got data from a TCP port. The control could have a table and it would appear that the client page was being updated, when it was actually just the control. Is the same possible with a custom web control in .net

Eric
 
Hi Eric,

The only thing I can give you is this. It is an example that I once have
made for someone, I do not believe that with this image it will function on
the web, however maybe you get an idea from it what you can use?

Cor

\\\Form 1 Needs a imagebox on the page
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.Image1.Height = New Unit(32)
Me.Image1.Width = New Unit(200)
Image1.Visible = True
Dim scriptString As String = "<script language=JavaScript>" & _
"setclock(); function setclock(){document.images.Image1.src = " & _

"'http://localhost/WebClock/WebForm2.aspx';setTimeout('setclock()',1000)}</s
cript>"
Page.RegisterStartupScript("setclock", scriptString)
End Sub
///
\\\Form2 needs nothing
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Response.Cache.SetExpires(DateTime.Now.AddTicks(500))
Dim myForeBrush As Brush = Brushes.Black
Dim myFont As New Font("Times New Roman", 8, FontStyle.Regular)
Dim textHeight As Single
Dim bm As New Bitmap(120, 20)
Dim g As Graphics = Graphics.FromImage(bm)
g.Clear(Color.White)
Dim textSize As SizeF = g.MeasureString("now.tostring", myFont)
g.DrawString(Now.ToString, myFont, myForeBrush, _
New RectangleF(0, 0, 120, 20))
Dim ms As New IO.MemoryStream
Dim arrImage() As Byte
bm.Save(ms, Imaging.ImageFormat.Bmp)
arrImage = ms.GetBuffer
Response.BinaryWrite(arrImage)
g.dispose
End Sub
///
 
Back
Top