Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-16-2005, 02:07 PM   #1 (permalink)
grand_marquisGT
USAF .NET Slacker
 
grand_marquisGT's Avatar
 
Join Date: Feb 2005
Posts: 7
grand_marquisGT is on a distinguished road
Alert in ASP.NET?

I was wondering how you display a client side alert window in ASP.NET...

Basically, I need both examples, both a OKCancel, and a regular OK...

Then, how do I use the integer returned from the user result?

Thanks in advance...
grand_marquisGT is offline   Reply With Quote
Old 06-16-2005, 07:55 PM   #2 (permalink)
jeffro
Person of interest
 
jeffro's Avatar
 
Join Date: Mar 2003
Location: New Jersey
Posts: 102
jeffro is on a distinguished road
It depends on what you want to do with it.

You can do it in javascript like this:
Code:
confirm("Are you sure you want to do this?");
That returns a boolean based on the users selection of "OK" or "Cancel"

Does that help?
__________________
Jeffro
Linux counter#:213782
GnuPG ID: 406238E7
jeffro is offline   Reply With Quote
Old 06-24-2005, 11:10 AM   #3 (permalink)
grand_marquisGT
USAF .NET Slacker
 
grand_marquisGT's Avatar
 
Join Date: Feb 2005
Posts: 7
grand_marquisGT is on a distinguished road
Is there a way to do it in the code in VB.NET?

This is what im trying.
'Declaring the variables.
Dim dbCmd As New SqlClient.SqlCommand
Dim dbConn As New SqlClient.SqlConnection
Dim dbAdap As New SqlClient.SqlDataAdapter
Dim msg As String
Dim title As String
Dim style As MsgBoxStyle
Dim response As MsgBoxResult
msg = "Are you sure you want to delete this activity?" ' Define message.
style = MsgBoxStyle.DefaultButton2 Or _
MsgBoxStyle.Critical Or MsgBoxStyle.YesNo
title = "Fit For TEST" ' Define title.
' Display message.
response = MsgBox(msg, style, title)
If response = MsgBoxResult.Yes Then ' User chose Yes.
'lblDebug.Text = drgFit.DataKeys(e.Item.ItemIndex())
dbConn.ConnectionString = Me.Application("DB_CONN_STRING")
dbCmd.CommandText = "procFIT_Person_Activity_Del"
dbCmd.CommandType = CommandType.StoredProcedure
dbCmd.Parameters.Add("@PersonID", Utilities.Login.GetLoggedOnUser(Me))
dbCmd.Parameters.Add("@PersonActivityID", drgFit.DataKeys(e.Item.ItemIndex()))
dbCmd.Connection = dbConn
dbConn.Open()
dbCmd.ExecuteNonQuery()
dbConn.Close()
fill_drgFit()
End If

This is what I get:

It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

I think this has something to do with running a client side action, on a server side prog. what gives?
grand_marquisGT is offline   Reply With Quote
Old 07-06-2005, 07:06 AM   #4 (permalink)
grand_marquisGT
USAF .NET Slacker
 
grand_marquisGT's Avatar
 
Join Date: Feb 2005
Posts: 7
grand_marquisGT is on a distinguished road
For future reference, this is what I found, and it works great!
Code:
Dim btn As System.Web.UI.WebControls.ImageButton
            btn = e.Item.FindControl("btnDelete")
            btn.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');")
grand_marquisGT is offline   Reply With Quote
Old 07-12-2005, 12:21 PM   #5 (permalink)
rdove
Masked Moderator
 
rdove's Avatar
 
Join Date: May 2002
Location: Indianapolis, IN
Posts: 260
rdove is on a distinguished road
Actually all that code above is doing is appending javascript to the html of your page. It is not issuing a message box from the server side. It is not possible to popup a message box from the server side. Just letting you know.
__________________
~Ryan

rdove is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to Disable Imagebutton in Asp.net sujith(ARS) HTML, XML, Javascript, AJAX 7 06-17-2005 03:17 AM
Checking a flag in Opened ASP.net page Continously ! mechtech MS Technologies ( ASP, VB, C#, .NET ) 1 04-19-2005 01:37 PM
new to asp.net rmill9681 MS Technologies ( ASP, VB, C#, .NET ) 5 11-29-2004 09:05 AM
javascript alert without refreshing? sde HTML, XML, Javascript, AJAX 2 06-30-2004 12:52 PM


All times are GMT -8. The time now is 07:29 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting