1

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

1

1 Answer 1

1

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/

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your help , can we improve the design of the java script alert and make it more customized without using jQuery ? you have any idea how the alert design using this jQuery would be ? is it like the one in the image that i have posted ? since I want to make a styled alert
No, you cannot do any changes to the javascript alert; the behavior is "hard wired". If you want to create the dialog your self using html, css and javascript you usually create your own html div or span that you may show or hide and functions like a dialog. To explore the options please look at the answers here: stackoverflow.com/questions/21655132/… About Jquery dialog:look at the jquery dialog page jqueryui.com/dialog for examples and customization options. (Sorry for not getting back earlier, I've had vacation.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.