Click here to Skip to main content
15,895,142 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Positioning plain text/html Pin
Not Active12-Jun-07 5:51
mentorNot Active12-Jun-07 5:51 
GeneralRe: Positioning plain text/html Pin
markymark8212-Jun-07 5:57
markymark8212-Jun-07 5:57 
Questionwww.dropthings.com related questions Pin
larree1112-Jun-07 5:22
larree1112-Jun-07 5:22 
QuestionSync Scrolling Pin
liona12-Jun-07 2:48
liona12-Jun-07 2:48 
AnswerRe: Sync Scrolling Pin
Arun.Immanuel12-Jun-07 3:07
Arun.Immanuel12-Jun-07 3:07 
GeneralRe: Sync Scrolling Pin
liona12-Jun-07 3:12
liona12-Jun-07 3:12 
AnswerRe: Sync Scrolling Pin
markymark8212-Jun-07 5:46
markymark8212-Jun-07 5:46 
QuestionASP.NET, AJAX and SQL Server question Pin
kallileo12-Jun-07 2:31
kallileo12-Jun-07 2:31 
This the code to initialize a button control that I have on my page:

Sub Page_Load(ByVal Sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then

SQLconn.Open()
Dim SelectCmd1 As New SqlCommand("SELECT [rawvalue] FROM [Data] WHERE (timestamp=(SELECT MAX(timestamp) FROM [Data]WHERE(name = 's1'))) AND (name='s1')", SQLconn)
SelectCmd1.CommandType = CommandType.Text
Dim result1 As Integer
Dim myDataReader1 As SqlDataReader
myDataReader1 = SelectCmd1.ExecuteReader()
myDataReader1.Read()
result1 = myDataReader1.GetInt32(0)
SQLconn.Close()

ChangeButton1(result1)

End If
End Sub


Sub ChangeButton1(ByVal Status As Integer)
If Status = -1 Then
Label1.Text = "ON"
OnOff1.Style.Value = "background-image: url(../ImgContr/1.png);"
Else
Label1.Text = "OFF"
OnOff1.Style.Value = "background-image: url(../ImgContr/2.png);"
End If
End Sub


Also I use to write to the database:

Sub OnOff_Click1(ByVal Sender As Object, ByVal e As System.EventArgs)

Dim updateCMD As SqlCommand
Dim query As String

If Label1.Text = "ON" Then
query = "UPDATE [Triggers] SET [rawvalue] = 'False' WHERE [name] = 's1'"
ChangeButton1(0)
Else
query = "UPDATE [Triggers] SET [rawvalue] = 'True' WHERE [name] = 's1'"
ChangeButton1(-1)
End If

updateCMD = New SqlCommand(query, SQLconn)
updateCMD.CommandType = CommandType.Text
SQLconn.Open()
updateCMD.ExecuteNonQuery()
SQLconn.Close()

End Sub

I used Ajax Update Panel with my button(OnOff1) inside to write the to the database without reloading the page.

What I want now is to poll the database every few seconds to read the values without pressing refresh(F5).
I believe that I have to use the Ontick event of the Update Panel Trigger and a asp Timer control.
How should I modify the Sub for Page_Load Event?
AnswerRe: ASP.NET, AJAX and SQL Server question Pin
Not Active12-Jun-07 2:51
mentorNot Active12-Jun-07 2:51 
GeneralRe: ASP.NET, AJAX and SQL Server question Pin
kallileo12-Jun-07 3:20
kallileo12-Jun-07 3:20 
GeneralRe: ASP.NET, AJAX and SQL Server question [modified] Pin
Not Active12-Jun-07 3:40
mentorNot Active12-Jun-07 3:40 
GeneralRe: ASP.NET, AJAX and SQL Server question Pin
kallileo12-Jun-07 4:05
kallileo12-Jun-07 4:05 
GeneralRe: ASP.NET, AJAX and SQL Server question [modified] Pin
Not Active12-Jun-07 5:33
mentorNot Active12-Jun-07 5:33 
QuestionUnable to start Debugging on the web server Pin
mohd imran abdul aziz12-Jun-07 2:14
mohd imran abdul aziz12-Jun-07 2:14 
QuestionPopup control unwanted postback Pin
Statia12-Jun-07 2:08
Statia12-Jun-07 2:08 
AnswerRe: Popup control unwanted postback Pin
Not Active12-Jun-07 2:42
mentorNot Active12-Jun-07 2:42 
Questionjavascript doubt Pin
saravanan0512-Jun-07 0:59
saravanan0512-Jun-07 0:59 
AnswerRe: javascript doubt Pin
Sylvester george12-Jun-07 1:09
Sylvester george12-Jun-07 1:09 
AnswerRe: javascript doubt Pin
rreddy.V12-Jun-07 1:11
rreddy.V12-Jun-07 1:11 
GeneralRe: javascript doubt Pin
saravanan0512-Jun-07 1:35
saravanan0512-Jun-07 1:35 
AnswerRe: javascript doubt Pin
rreddy.V12-Jun-07 1:41
rreddy.V12-Jun-07 1:41 
AnswerRe: javascript doubt Pin
badgrs12-Jun-07 1:42
badgrs12-Jun-07 1:42 
AnswerRe: javascript doubt Pin
Christian Graus12-Jun-07 1:52
protectorChristian Graus12-Jun-07 1:52 
GeneralRe: javascript doubt Pin
Bajrang Singh13-Jun-07 5:11
Bajrang Singh13-Jun-07 5:11 
QuestionHow to Scroll while drag and drop in c# Pin
Sapan Roy12-Jun-07 0:52
Sapan Roy12-Jun-07 0:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.