473,597 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript Confirm msgbox...

TJ
Hi,

I would like to ask something to user after user submits the form...
I know I can ask user whehter they want to submit the form or not using
client-script code such as onClick or onSubmit by adding into attributes
collections...

My problem is a little bit different than that...
I would like to ask user something after submission is done

Suppose that this is the behind code when user clicks the submit button...

private void btnSubmit_Click (object sender, System.EventArg s e)
{
//..blah..
//..blah...
//..blah...
//Form data will be saved into database...
//At this point, I would like to ask user something.like. .
// if(confirm('Do you want to process more?') == true) {
// redirect to specific page with QueryParameters
// }
// else
// {
// redirect to main page..
// }

}

Any idea?

Thanks.

Nov 19 '05 #1
3 4503
"TJ" <TJ@discussions .microsoft.com> wrote in message
news:49******** *************** ***********@mic rosoft.com...
Hi, [snip] My problem is a little bit different than that...
I would like to ask user something after submission is done

Suppose that this is the behind code when user clicks the submit button...

private void btnSubmit_Click (object sender, System.EventArg s e)
{
//..blah..
//..blah...
//..blah...
//Form data will be saved into database...
//At this point, I would like to ask user something.like. .
// if(confirm('Do you want to process more?') == true) {
// redirect to specific page with QueryParameters
// }
// else
// {
// redirect to main page..
// }


IMHO-Create a new page for the 'Do you want to process more?' question.
Then redirect from there.

Nov 19 '05 #2
This is one method..

Create a javascript funtion as below (please note - Syntax is wrong. .this
is psudo code)
<script>
function Confirm(var QueryParameters )
{
if(window.confi rm("'Do you want to process more?"))
{
//javascript code to redirect to specific page with QueryParameters

}
else
{
//javascript code to redirect to main page
}
}
</script>

in code behind after //Form data will be saved into database...

string QueryParameters = //construct query params here
Page.RegisterSt artupScript("so mename","<scrip t>Confirm(' " + QueryParameters
+ " ') </script>")
When the code behind done with execution, it will emit a javascript to call
the javascript function "Confirm"
"TJ" wrote:
Hi,

I would like to ask something to user after user submits the form...
I know I can ask user whehter they want to submit the form or not using
client-script code such as onClick or onSubmit by adding into attributes
collections...

My problem is a little bit different than that...
I would like to ask user something after submission is done

Suppose that this is the behind code when user clicks the submit button...

private void btnSubmit_Click (object sender, System.EventArg s e)
{
//..blah..
//..blah...
//..blah...
//Form data will be saved into database...
//At this point, I would like to ask user something.like. .
// if(confirm('Do you want to process more?') == true) {
// redirect to specific page with QueryParameters
// }
// else
// {
// redirect to main page..
// }

}

Any idea?

Thanks.

Nov 19 '05 #3

there are a couple of ways to do it, depending on your needs...but the
quickest that I can come up with is...

1) Create a new new page...say Redirect.aspx
2) From your button click event, do your DB stuff and build the
QueryParameters that you may use...concatena te Redirect.aspx?< Query
Paramter>
3) On the Redirect.aspx page, have a javascript function that
prompts...and depending on the prompt...do a Window.location ....

if that doesn't work for you or post back and we can try a different
method....
--
rviray
------------------------------------------------------------------------
rviray's Profile: http://www.msusenet.com/member.php?userid=4211
View this thread: http://www.msusenet.com/t-1871095247

Nov 19 '05 #4

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

Similar topics

1
2643
by: Muhammad Abdullah | last post by:
Hi am having some problems with the javascript confirm. i have it working fine on one page and it doesnt even pop up at the other. The code on the working page is, private void Page_Load(object sender, System.EventArgs e) { if(! Page.IsPostBack)
9
4902
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work fine from a link. The button does bring up the popup window, but when I press the links on the page, it doesn't return or close the window. ****************************************************************************
7
2017
by: TJS | last post by:
javascript "confirm" fires after deletion instead of before deletion. how do I get this to stop the processing ? code ================== Sub ShowAlert(ByVal s As string) RegisterClientScriptBlock("CSP-showconfirm-function", _ "<s"+"cript language=""JavaScript"">" & vbCrLf & _
12
2124
by: tshad | last post by:
I have the following code that attaches a Javascript confirm box to my checkbox. When I select the checkbox, the window comes up fine, but it never executes the XfertoDefault_Click function when I press the Yes button. If I take off the Javascript event, the checkbox works fine. XferToDefault.Attributes.Add("onclick", "return confirm('Are you sure you want copy these entries?');") <asp:CheckBox ID="XferToDefault" AutoPostBack="true"...
8
33667
by: Dave | last post by:
Hello all, I have been able to use a Javascript alert box in my vb.net web application, for example: Dim msg As String = "Hello, world." Dim alertScript As String = "<script language=JavaScript runat=server>" alertScript &= "alert('" & msg & "');" alertScript &= "</script>"
4
10019
by: tfsmag | last post by:
Okay, I have a project management app i'm writing and in the left hand menu i have a treeview control that is populated with each project... in child nodes under each project node I have an "edit" and a "delete" node. I have the functionality of the edit and delete working fine, my issue is now however that I cannot seem to find a way to add an "onclick" event that fires a confirm box. I've tried this method.. treenode.Text = "<a...
6
2521
by: den 2005 | last post by:
Hi everybody, Question 1: How do you set the values from server-side to a client-side control or how do you execute a javascript function without a button click event? Question 2: How do you get response from a Confirm() popup window to uncheck all server-side checkboxes placed in a panle of a web user control? I am using ASP.Net 2.0, Thanks. Need info...
8
4024
by: rn5a | last post by:
I have gone through a no. of posts in this NewsGroup regarding my problem but alas, couldn't come across one which would have helped me in resolving the issue. My problem is this: An ASPX Form has a Button. When the Button is clicked, I want a JavaScript confirm dialog to pop-up with the options 'OK' & 'Cancel'. I have done this using the following code: Sub Page_Load(....) btnClick.Attributes.Add("OnClick", "javascript:return...
1
108708
Frinavale
by: Frinavale | last post by:
Introduction I've seen many questions asked about how to disable the browser's back button and in the past I've replied with "it's simply not possible". It's not a good idea to disable the back button anyways, if the user ventures away from your page then they wouldn't have this button at their disposal. The main reason people ask how to control or disable the back button is because they have a need to control sensitive (and/or) dynamic web...
0
7885
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8380
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6686
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5426
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3881
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
1231
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.