467,182 Members | 1,044 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,182 developers. It's quick & easy.

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.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
  • viewed: 4268
Share:
3 Replies
"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
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

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.

Similar topics

1 post views Thread by Muhammad Abdullah | last post: by
12 posts views Thread by tshad | last post: by
4 posts views Thread by tfsmag | last post: by
6 posts views Thread by den 2005 | last post: by
8 posts views Thread by rn5a@rediffmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.