Link to home
Create AccountLog in
Avatar of adminender
adminender

asked on

Asp .net Ajax modalpopup event

Hi, i have a asp .net page. there is a button in the page and it validates user account information and logins to system. and i design a modalpopup and it works like a messagebox. i want to show the modalpopup if the user informations is not valid. how can i do. now modalpopup opens every click event. thanks for help.
SOLUTION
Avatar of P1ST0LPETE
P1ST0LPETE
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Avatar of Kumaraswamy R
Kumaraswamy R
Flag of India image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of adminender
adminender

ASKER

My problem is this:
this is my login page. and this is the code for login button

   Protected Sub btn_giris_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_giris.Click

        If (txt_kullanici_adi.Text.Length = 0) Then

            ModalPopupExtender1.TargetControlID = "btn_giris"
            Label1.Text = "Lütfen Kullanici Adi Giriniz!"
            ModalPopupExtender1.Show()

        ElseIf (txt_sifre.Text.Length = 0) Then
            ModalPopupExtender1.TargetControlID = "btn_giris"
            Label1.Text = "Lütfen Sifre Giriniz!"
            ModalPopupExtender1.Show()

        Else
            If (con.State = Data.ConnectionState.Closed) Then
                con.Open()
            End If
            sorgu.CommandText = "select fn1, fn2, fn3, fn4 from gm_tbl1 where(fn2='" + txt_kullanici_adi.Text + "')"
            If (con.State = Data.ConnectionState.Open) Then
                con.Close()
            End If
        End If
 
    End Sub



When i set the username textbox blank i get this screen.

 User generated image

after i input my user name and set password blank. i already gives the same message.

 User generated image

How i can fix this problem. can you give an example to fix this problem. i am new in  ajax.
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
i made it how u said but it didn't make any change. i found a solution. i put my label into a updatepanel. after that my message text changed. thaks for your comments.
Thanks