JavaScript Confirm msgbox...

G

Guest

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.
 
J

John MacIntyre

TJ said:
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.
 
G

Guest

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>Confirm(' " + QueryParameters
+ " ') </script>")


When the code behind done with execution, it will emit a javascript to call
the javascript function "Confirm"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top