Message window using VB.NET in ajax

This article is used to show message window in vb.net using ajax. The problem comes when you use vb.net using ajax enables website.. This concept is easy to use in C# but it is not easy in vb.net. I am writing two line code for this message window.

Private Sub DisplayClientError(ByVal errorDesc As String)
Dim script As String = “alert(‘” + errorDesc + “‘);”
ScriptManager.RegisterStartupScript(Me, GetType(Page), “UserSecurity”, script, True)
End Sub ‘DisplayClientError write this code on click event where you want show message window
Protected Sub ClickButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) HandlesClickButton.Click
If TextBox1.Text = “” Then
DisplayClientError(“Enter some text in text box”)
End If
End Sub

Screenshot:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s