Hi Friends
I have a Textbox and a button
when i am clicking the button it should be shows javascript alert messege if textbox is empty otherwise shows javascript msg "Hello"
i have return this
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text <> "" Then
Button1.Attributes.Add("onclick", "javascript:return " & "alert('Hello')")
Else
Button1.Attributes.Add("onclick", "javascript:return " & "alert('Select Financial Year First')")
End If
End Sub
it's works fine but if TextBox is Blank.. first time clicking button nothing happens , second time show messege 'Select Financial Year First' then if delete the text
and clicking button first it shows 'Select Financial Year First' then after clicking it shows 'Hello'
what is going wrong?
Thanks in advance