Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 5th, 2005, 10:42 PM
Authorized User
 
Join Date: Apr 2005
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default MessageBox using Javascript

Hi,i have a page for delete user option. I use javascript
to pop up confirmation message. after user click ok and the user is deleted, I wan to display messagebox states "This user has been deleted.". How to have the 2nd messageBox displayed? Is it I need to put the code in PageLoad oso?

I tried the coding below, but none of the 2 msgbox is displayed.
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete?');")
        btnDelete.Attributes.Add("onclick", "delete();")
End Sub
[html code]
<HEAD>
        <title>DeleteUser</title>
        <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
        <meta name="vs_defaultClientScript" content="JavaScript">
        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    <script language =javascript>
    function delete()
    {
    alert("This user has been deleted from record.");
    }
    </script>
    </HEAD>
[/html code]

thanks!

Irene



 
Old June 6th, 2005, 03:46 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

In Delete button handler after the successful deletion,

Register this Client Script using RegisterStartupScript,
 <script language =javascript>
    {
    alert("This user has been deleted from record.");
    }
    </script>

Or just set this as the text of a literal control

Prashant



 
Old June 6th, 2005, 04:54 AM
Authorized User
 
Join Date: Apr 2005
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I wan to display it in messageBox. My 1st msgBox will ask user to
confirm deletion, 2nd msgBox will only displayed after User click ok
in 1st msgBox.

where should i put ur suggested coding? Is it in HTML page for this file?

I tried put it in the body of html file after the declaration of delete button.
But the 2nd msgBox is displayed once the page is loaded. I m not sure where to put it?

Thanks!

 
Old June 7th, 2005, 01:39 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Put literal control (litmsg)at the bottom of page with no text.

Now in your
btnDelete_Click()
{
 //do your deletion stuff


strMsg="<script language =javascript>{alert("This user has been deleted from record."); }</script>"

litMsg.Text = strmsg;

}


Prashant

 
Old June 7th, 2005, 01:40 AM
Friend of Wrox
 
Join Date: Apr 2005
Posts: 186
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

Wait, change alert("This user has been deleted from record.");
TO alert('This user has been deleted from record.');

in the previous post

Prashant








Similar Threads
Thread Thread Starter Forum Replies Last Post
MessageBox Lalit Pradhan ASP.NET 2.0 Professional 1 July 5th, 2006 12:03 PM
MessageBox Ric_H General .NET 2 April 19th, 2006 01:45 PM
How to use MessageBox johnsonlim026 ASP.NET 1.0 and 1.1 Basics 7 June 17th, 2005 10:21 AM
another ques regarding Javascript messagebox hoailing22 ASP.NET 1.0 and 1.1 Basics 6 June 7th, 2005 01:10 AM
MessageBox asbayani ASP.NET 1.0 and 1.1 Basics 3 July 29th, 2003 03:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.