Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 3rd, 2004, 09:50 AM
Authorized User
 
Join Date: Jun 2003
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using Alerts

I'm using an alert when the user enters the wrong information in a text box, but it's not working properly. When you enter the wrong information the first time the page appears to refresh itself, but the alert doesn't come up. Then, when you enter the wrong information the second time the alert pops up and takes the appropriate action. When I go back to enter the correct information, the alert comes up again, when it should not, and then it performs the correct action.

Any help would be a appreciated
Thanks,

Renee C. Walker
__________________
Renee C. Walker
 
Old March 3rd, 2004, 10:48 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

It sounds like you are doing the check in the wrong place and getting the typical 1-hit delay that aspx beginners often see. Post the relevant parts of the code and we'll see what we can do.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old March 3rd, 2004, 11:00 AM
Authorized User
 
Join Date: Jun 2003
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click

        Dim user As String

        Dim response As String

        Dim msg As String

        Dim myconnection As SqlClient.SqlConnection = New SqlClient.SqlConnection

        myconnection.ConnectionString = "Data Source=WJEVIS;database=WJEVISION;User ID=xx;Password=xxx"

        myconnection.Open()







        Dim comSQL As SqlClient.SqlCommand = New SqlClient.SqlCommand



        'Add code to set CommandText and Connection properties of the command

        'If (txtLogin.Text = "" Or txtLogin.Text = "Please enter something.") Then

        ' txtLogin.Text = "Please enter a valid Login."

        ' Return

        'End If



        comSQL.CommandText = "select username,password from seuser where username = '" & txtLogin.Text & "'"

        comSQL.CommandText = "select * from seuser where username = '" & txtLogin.Text & "'"

        comSQL.Connection = myconnection





        Dim readerSQL As SqlClient.SqlDataReader

        'Add code to execute the command

        readerSQL = comSQL.ExecuteReader()

        user = txtLogin.Text





        'Add code to loop through the records, add each to the listbox

        If readerSQL.HasRows Then

            Do While readerSQL.Read

                'Display in list box

                'lstUsers.Items.Add(readerSQL.Item("username").ToS tring) '& " " & readerSQL.Item("LastName").ToString)

                Dim file As New System.IO.StreamWriter("C:\test.txt", True)

                file.WriteLine("Here is the first line." & " " & user)

                file.Close()

                Server.Transfer("Webform1.aspx")

            Loop

        Else

            Page.RegisterStartupScript("MyScript", _

            "<script language=javascript>" & _

   "function AlertHello() { alert('Please enter the correct username'); }</script>")



            btnLogin.Attributes("onclick") = "AlertHello()"

            txtLogin.Text = ""

            Return



        End If





    End Sub


Renee C. Walker





Similar Threads
Thread Thread Starter Forum Replies Last Post
Timed alerts. jpool Visual Basic 2005 Basics 4 June 28th, 2008 09:26 AM
catch the alerts catchrohith Classic ASP Basics 1 October 26th, 2006 06:39 AM
Closing Pages and popup alerts Quick209 ASP.NET 2.0 Basics 0 November 14th, 2005 09:26 PM
Formatting Alerts fs22 Javascript How-To 3 June 9th, 2004 04:15 PM
Alerts rwalker ASP.NET 1.0 and 1.1 Basics 8 March 8th, 2004 09:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.