How to Use Message Box in ASP.NET

Message boxes that are used on a Web page typically alert a user to an action or event on that Web page. If you want to display a message box on the user's screen, add the code for the message box to your ASP.NET Web page. A message box can include text to read or buttons that require user action. To do this, edit your ASP.NET Web page in your favorite text editor.

Instructions

    • 1

      Type “<input type=”submit” name=”DeleteBtn” value=”Delete” id=”DeleteBtn” />” to create a Button Web control for your Web page. The Button Web control is the image of the button that will be clicked on the Web page.

    • 2

      Type “Private Sub_Page_Load(ByVal sender As System.Object, _ByVal e As System.EventArgs) Handles Mybase.Load.” Press the “Enter” key.

    • 3

      Type “If (Not Page.IsPostPack) Then.” Press the “Enter” key.

    • 4

      Type “Me.DeleteBtn.Attributes.Add(“onclick=” , _ “return confirm('Confirm that you want to delete');”)." Press the “Enter” key.

    • 5

      Type “End If” and press the “Enter” key. Type “End Sub” to complete the code for the message box.

    • 6

      Click the “File” menu and select the option for “Save.” Load the Web page to your server to test the code for the message box.

Related Searches:

Resources

Comments

Related Ads

Featured