Click here to Skip to main content
16,010,544 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Submit Button Pin
Not Active12-Jun-07 8:04
mentorNot Active12-Jun-07 8:04 
AnswerRe: Submit Button Pin
Biju Sam12-Jun-07 19:05
Biju Sam12-Jun-07 19:05 
GeneralRe: Submit Button Pin
Bajrang Singh13-Jun-07 4:47
Bajrang Singh13-Jun-07 4:47 
QuestionDataGrid dropping values Pin
wood060112-Jun-07 6:45
wood060112-Jun-07 6:45 
AnswerRe: DataGrid dropping values Pin
Not Active12-Jun-07 6:56
mentorNot Active12-Jun-07 6:56 
GeneralRe: DataGrid dropping values Pin
wood060112-Jun-07 7:10
wood060112-Jun-07 7:10 
GeneralRe: DataGrid dropping values Pin
wood060112-Jun-07 7:34
wood060112-Jun-07 7:34 
GeneralRe: DataGrid dropping values Pin
Not Active12-Jun-07 8:24
mentorNot Active12-Jun-07 8:24 
QuestionPositioning plain text/html Pin
markymark8212-Jun-07 5:25
markymark8212-Jun-07 5:25 
AnswerRe: Positioning plain text/html Pin
Not Active12-Jun-07 5:37
mentorNot Active12-Jun-07 5:37 
GeneralRe: Positioning plain text/html Pin
markymark8212-Jun-07 5:42
markymark8212-Jun-07 5:42 
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 

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.