By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,018 Members | 1,204 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,018 IT Pros & Developers. It's quick & easy.

JavaScript Confirm msgbox...

P: n/a
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.EventArgs 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
Share this Question
Share on Google+
3 Replies


P: n/a
"TJ" <TJ@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.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.EventArgs 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

P: n/a
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.confirm("'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.RegisterStartupScript("somename","<script>Con firm(' " + 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.EventArgs 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

P: n/a

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...concatenate 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 discussion thread is closed

Replies have been disabled for this discussion.