473,379 Members | 1,302 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,379 software developers and data experts.

Refresh WebForm

NN
Hello, I have a problem :)

I have a webform in which I have the event Onload that refers to a script
that find in a database for an image and then show it in the WebForm. The
problem is that I want to repeat the search automatically every 5 seconds. I
Already tried with <meta http-equiv="refresh" content="5"/> but if i having
the OnLoad in the form, does not do anything, does not refresh. I don't know
what to do : (

I hope that someone could help, for the doubts I pass the code of the
script. Thank you very much!
<script runat="server">
Public Sub MostrarImagen(ByVal sender As Object, ByVal e As
System.EventArgs)

Dim cadena As String = "Database=vigilancia;DataSource=localhost;User
Id=root;password=vigilancia"

Dim query As String = "Select * from imagenes"

Dim conn As New MySqlConnection(cadena)

Dim da As New MySqlDataAdapter(query, conn)

Dim ds As New DataSet

conn.Open()

da.Fill(ds, "Vigilancia")

Dim contador As Integer

contador = ds.Tables("Vigilancia").Rows.Count

Dim myRow As DataRow

myRow = ds.Tables("Vigilancia").Rows(contador - 1)

Dim myData() As Byte

myData = myRow("imagen")

Response.Buffer = True

Response.ContentType = "Image/JPEG"

Response.BinaryWrite(myData)

End Sub

</script>
Jun 27 '06 #1
2 1815
You can't send both a page and a binary image to the browser. As you are
sending an image, you don't have a page any more, so there is no page
header where you can put the meta tag.

NN wrote:
Hello, I have a problem :)

I have a webform in which I have the event Onload that refers to a script
that find in a database for an image and then show it in the WebForm. The
problem is that I want to repeat the search automatically every 5 seconds. I
Already tried with <meta http-equiv="refresh" content="5"/> but if i having
the OnLoad in the form, does not do anything, does not refresh. I don't know
what to do : (

I hope that someone could help, for the doubts I pass the code of the
script. Thank you very much!
<script runat="server">
Public Sub MostrarImagen(ByVal sender As Object, ByVal e As
System.EventArgs)

Dim cadena As String = "Database=vigilancia;DataSource=localhost;User
Id=root;password=vigilancia"

Dim query As String = "Select * from imagenes"

Dim conn As New MySqlConnection(cadena)

Dim da As New MySqlDataAdapter(query, conn)

Dim ds As New DataSet

conn.Open()

da.Fill(ds, "Vigilancia")

Dim contador As Integer

contador = ds.Tables("Vigilancia").Rows.Count

Dim myRow As DataRow

myRow = ds.Tables("Vigilancia").Rows(contador - 1)

Dim myData() As Byte

myData = myRow("imagen")

Response.Buffer = True

Response.ContentType = "Image/JPEG"

Response.BinaryWrite(myData)

End Sub

</script>

Jun 27 '06 #2
NN
So? No solution?

"Göran Andersson" <gu***@guffa.com> escribió en el mensaje
news:uW**************@TK2MSFTNGP04.phx.gbl...
You can't send both a page and a binary image to the browser. As you are
sending an image, you don't have a page any more, so there is no page
header where you can put the meta tag.

NN wrote:
Hello, I have a problem :)

I have a webform in which I have the event Onload that refers to a script that find in a database for an image and then show it in the WebForm. The problem is that I want to repeat the search automatically every 5 seconds. I Already tried with <meta http-equiv="refresh" content="5"/> but if i having the OnLoad in the form, does not do anything, does not refresh. I don't know what to do : (

I hope that someone could help, for the doubts I pass the code of the
script. Thank you very much!
<script runat="server">
Public Sub MostrarImagen(ByVal sender As Object, ByVal e As
System.EventArgs)

Dim cadena As String = "Database=vigilancia;DataSource=localhost;User
Id=root;password=vigilancia"

Dim query As String = "Select * from imagenes"

Dim conn As New MySqlConnection(cadena)

Dim da As New MySqlDataAdapter(query, conn)

Dim ds As New DataSet

conn.Open()

da.Fill(ds, "Vigilancia")

Dim contador As Integer

contador = ds.Tables("Vigilancia").Rows.Count

Dim myRow As DataRow

myRow = ds.Tables("Vigilancia").Rows(contador - 1)

Dim myData() As Byte

myData = myRow("imagen")

Response.Buffer = True

Response.ContentType = "Image/JPEG"

Response.BinaryWrite(myData)

End Sub

</script>

Jun 28 '06 #3

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

Similar topics

1
by: hqdtech | last post by:
how to refresh webform from other webform I have 2 webform, i want if webform A was close then webform B wil refresh. And the problem second: how to catch packet on the network in C#. ...
3
by: VB Programmer | last post by:
My webform is datadriven and auto refreshes every 10 seconds. Is there a way to avoid the "flicker" when I refresh the page?
10
by: tasmisr | last post by:
This is an old problem,, but I never had it so bad like this before,, the events are refiring when clicking the Browser refresh button. In the Submit button in my webform, I capture the server side...
1
by: koby maman | last post by:
Hello I have two questions 1. I have a webform A, which by clicking on certain control, i open in a new window a webform B I want, when the webform B is closed, to refresh (Page_Load ? ) the...
3
by: *no spam* | last post by:
How do you refresh the controls on a panel? I've got a VB webform which contains a panel. On that panel is a checkbox and a textbox. I'd like the textbox to appear when the checkbox is checked...
1
by: Pravin | last post by:
Hi, I have a ASP.net webform opened. I want to open a model dialog box on the button click. When the dialog box is opened, the webform is shown blank because the post back is not complete unless...
1
by: ACaunter | last post by:
Hi, I was wondering if there was asp.net webform (serverside) code which will refresh the page. I get a download dialog box that keeps poppin up everytime i click on any buttons on my page and i...
2
by: NATE | last post by:
Could you tell me how I can refresh a aspx webform without press a button. I need to refresh a text box periodically without the action of the user
4
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. If an ASP.NET page postsback, for example, after a button is clicked, and then I refresh the page (ie, by pressing F5 key), why does the same event occur when I press F5 as it did when I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.