user
user

Reputation: 631

How to make a dialog in asp.net using vb.net and java script

In my asp.net website,i want to show a notification to the user when he/she try to delete data , i have used a msgbox in my vb code but it didn't work on the server side , i have searched and found that i should use java script alert ,i have used it but the problem is that it appears at the top of the screen and its so simple how can i make an alert or dialog like the following image using java script and vb

enter image description here

this is my code

 Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDelete.Click

   ScriptManager.RegisterStartupScript(Page, Page.GetType,Guid.NewGuid().ToString(), "alert('you cannot delete this data ')", True)

  End Sub

Please any one can help me , any help would be appreciated

Thanks in advance

Upvotes: 1

Views: 854

Answers (1)

mortb
mortb

Reputation: 9839

The problem is that a dialog box is not built into asp.net. You need to either just use the javascript alert / confirm functions, create the dialogbox yourself using html or import a GUI-library such as JQuery UI.

Here is a guide on how to use JQuery UI dialog, which I have used many times in ASP.NET: https://cmatskas.com/how-to-use-jquery-dialog-as-confirm-dialog-in-asp-net/

Upvotes: 1

Related Questions