473,466 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Dialog boxes with ASP

Hi,

I am trying to initiate a dialog box in an ASP web page. The code does some
processing and checks a few things, then if all is OK, asks the user to
confirm. For this I need it to pop up a simple OK/Cancel dialog box, read
the result, and act accordingly.

This would of course be very simple in a Windows application, but it seems
that is not the case in ASP. All the solutions I have found so far involve
running javascript when the inital button is pressed to pop up the dialog
box, and then passing the result to the ASP code for it to process.

Unfortunately I need to go to the ASP code first, do some processing, pop up
the dialog box if required, and return the result to the ASP code for it to
act upon. So basically I need to do something that will to all intents and
purposes act like a standard MessageBox.

I'm familiar with VB.NET and C#.NET, but this is my first time trying to do
an ASP.NET page.

Any help much appreciated!

Mat
Sep 7 '07 #1
3 1624
The JavaScript confirm() function will do what you want. It takes a string
(message) as an argument, presents a Message Box with an OK and a Cancel
button, and returns true if the OK button is pressed, false if the Cancel
button is pressed.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Mat" <Ma*@discussions.microsoft.comwrote in message
news:58**********************************@microsof t.com...
Hi,

I am trying to initiate a dialog box in an ASP web page. The code does
some
processing and checks a few things, then if all is OK, asks the user to
confirm. For this I need it to pop up a simple OK/Cancel dialog box, read
the result, and act accordingly.

This would of course be very simple in a Windows application, but it seems
that is not the case in ASP. All the solutions I have found so far
involve
running javascript when the inital button is pressed to pop up the dialog
box, and then passing the result to the ASP code for it to process.

Unfortunately I need to go to the ASP code first, do some processing, pop
up
the dialog box if required, and return the result to the ASP code for it
to
act upon. So basically I need to do something that will to all intents
and
purposes act like a standard MessageBox.

I'm familiar with VB.NET and C#.NET, but this is my first time trying to
do
an ASP.NET page.

Any help much appreciated!

Mat

Sep 7 '07 #2
I've come across that, but the trouble is I don't know how to call that
Javascript...

Say I have some simple javascript in the header of the ASP page, e.g.

function MyJavaScript()
{
if (confirm(msg))
{
return ("true")
}
else
{
return ("false")
}
}

and I reach the point in my ASP code where I need to get the user response,
how do I make my ASP code call that function and read the answer?

For example, in a windows app, I could use: -

DialogResult DR = MessageBox.Show("Hello", "", MessageBoxButtons.OKCancel);
I appreciate I may be missing something rather obvious, but thanks anyway!

Mat

"Kevin Spencer" wrote:
The JavaScript confirm() function will do what you want. It takes a string
(message) as an argument, presents a Message Box with an OK and a Cancel
button, and returns true if the OK button is pressed, false if the Cancel
button is pressed.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Mat" <Ma*@discussions.microsoft.comwrote in message
news:58**********************************@microsof t.com...
Hi,

I am trying to initiate a dialog box in an ASP web page. The code does
some
processing and checks a few things, then if all is OK, asks the user to
confirm. For this I need it to pop up a simple OK/Cancel dialog box, read
the result, and act accordingly.

This would of course be very simple in a Windows application, but it seems
that is not the case in ASP. All the solutions I have found so far
involve
running javascript when the inital button is pressed to pop up the dialog
box, and then passing the result to the ASP code for it to process.

Unfortunately I need to go to the ASP code first, do some processing, pop
up
the dialog box if required, and return the result to the ASP code for it
to
act upon. So basically I need to do something that will to all intents
and
purposes act like a standard MessageBox.

I'm familiar with VB.NET and C#.NET, but this is my first time trying to
do
an ASP.NET page.

Any help much appreciated!

Mat


Sep 7 '07 #3
"Mat" <Ma*@discussions.microsoft.comwrote in message
news:BE**********************************@microsof t.com...
and I reach the point in my ASP code where I need to get the user
response,
how do I make my ASP code call that function and read the answer?
You keep mentioning ASP - I presume you mean ASP.NET and not ASP...?
For example, in a windows app, I could use: -

DialogResult DR = MessageBox.Show("Hello", "",
MessageBoxButtons.OKCancel);

I appreciate I may be missing something rather obvious, but thanks anyway!
<asp:Button ID="cmdDelete" runat="server" Text="Delete"
OnClientClick="return confirm('Are you sure you want to delete this
record?');"
OnClick="cmdDelete_Click" />

When the above button is clicked, the user will be asked to confirm that
they want to delete the record. If no, nothing further will happen. If yes,
the page will postback and run the cmdDelete_Click method.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 7 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Laxmikant Rashinkar | last post by:
Hello, from inside a button handler, I am launching a dialog box that contains lables and text boxes. The dialog box is launched using dlg.Show(). In this situation the contents of the text...
23
by: George | last post by:
Is there a way to customize the open file common dialog? I am trying to modify the button text so I can create a delete file common dialog. I need the same functionality of the open file common...
0
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they...
6
by: Fred | last post by:
I have implemented a dialog box (an aspx page) using showModalDialog. Because the dialog needs to process postbacks, I have implemented it in a frameset. In the top of the framset page, I have...
3
by: Tom McLaughlin | last post by:
I am having problems locating the "Find and Replace Dialog Boxes". My toolbox shows other Dialog Boxes. The Customize Toolbox dialog box displays a list of all .NET Framework components available...
2
by: Marco | last post by:
I have no idea what happened but for some odd reason the text in my dialog boxes isn't showing up. It's not just the message but also the text on the buttons. This only happens when the visual...
1
by: InfoDevGuy | last post by:
Hi: We are a software company. Our product (Dialogue) is very expansive with lots of menus, dialog boxes, etc in the GUI. We use unstructured FM 7.2. Every time we have a new release,...
2
by: one.1more | last post by:
I want to make a text game using javascript dialog boxes. i learned about confirm boxes but its not helpful(http:// www.javascriptmall.com/learn/lesson6.htm) 1. for ex, in the confirm boxes,...
1
by: =?Utf-8?B?QmVuIEM=?= | last post by:
I'm getting dialog boxes from a variety of applications appear very distorted. They are often extremely large covering all the screen whilst the main application appears normally. eg. This happens...
3
by: Mike Hofer | last post by:
Okay, here's the situation: we want to be able to display ASPX pages in an UpdatePanel. The reasons for this are performance related. The site in development uses *lots* of modal popups from some...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.