Adding MessageBox to my aspx page

G

Guest

I know this isn't the best group to post aspnet question, but the MS asp.net
NG hasn't been very helpful lately.
I've been trying to add a messagebox following the examples I've seen on the
web, but with no luck.
I have an aspx page where the user enters a bunch of data and clicks
'Submit'. When the user clicks on the 'Submit', I want to run an SP that
returns true/false depending on the data. If false, then my MessageBox will
pop up saying "It's false. Do you want to make it true?". If the user clicks
Ok, then I'll load "myResult.aspx".This is the pseudo-code for it:
private void btnClose_Click(object sender, System.EventArgs e)
{
bool result = "RUN MY STORED PROC";
if (result)
{
SHOW MY JAVASCRIPT MESSAGEBOX
}
}
PRIVATE VOID MESSAGEBOX()
{
IF (JAVASCRIPT MESSAGEBOX.RESULT == "OK")
{
Response.Redirect ("myResult.aspx");
}
}

I've googled this, but I haven't found too many helpful links. The ones I've
found assume too many things and they only explain how to display a
messagebox (not how to process the result).
Any help is appreciated.
 
G

Guest

hi,
1. add a hidden text box named txtHidden in .aspx file.

2. in your pseudo code,

private void btnClose_Click(object sender, System.EventArgs e)
{
txtHidden.Text = "RUN MY STORED PROC";

}

3. in end of .aspx file, before </body> tag, add the following script

<script language="javascript">
if(document.all("txtHidden").value =="false")
{
if(confirm(""It's false. Do you want to make it true?")
{
window.open("myResult.aspx");
}
}

</script>
</body>
</HTML>

let me know if u have problem.
 
G

Guest

Thanks for the post.
I understand most of your solution, but I don't understand how the the
button Click event is linked to the javascript code (i.e. when will this
javascript code run?).

Thanks.

Amalorpavanathan Yagulasamy(AMAL)MCP said:
hi,
1. add a hidden text box named txtHidden in .aspx file.

2. in your pseudo code,

private void btnClose_Click(object sender, System.EventArgs e)
{
txtHidden.Text = "RUN MY STORED PROC";

}

3. in end of .aspx file, before </body> tag, add the following script

<script language="javascript">
if(document.all("txtHidden").value =="false")
{
if(confirm(""It's false. Do you want to make it true?")
{
window.open("myResult.aspx");
}
}

</script>
</body>
</HTML>

let me know if u have problem.
--
Regards,
Amal [MCP, MCS]
http://geocities.com/techsharing


VMI said:
I know this isn't the best group to post aspnet question, but the MS asp.net
NG hasn't been very helpful lately.
I've been trying to add a messagebox following the examples I've seen on the
web, but with no luck.
I have an aspx page where the user enters a bunch of data and clicks
'Submit'. When the user clicks on the 'Submit', I want to run an SP that
returns true/false depending on the data. If false, then my MessageBox will
pop up saying "It's false. Do you want to make it true?". If the user clicks
Ok, then I'll load "myResult.aspx".This is the pseudo-code for it:
private void btnClose_Click(object sender, System.EventArgs e)
{
bool result = "RUN MY STORED PROC";
if (result)
{
SHOW MY JAVASCRIPT MESSAGEBOX
}
}
PRIVATE VOID MESSAGEBOX()
{
IF (JAVASCRIPT MESSAGEBOX.RESULT == "OK")
{
Response.Redirect ("myResult.aspx");
}
}

I've googled this, but I haven't found too many helpful links. The ones I've
found assume too many things and they only explain how to display a
messagebox (not how to process the result).
Any help is appreciated.
 
G

Guest

button Click event is not linked to the javascript code.
the java script will run, whenever the page is refreshed.
that means, end of all server and client events.

so myResult.aspx will open whenever the condition
if(document.all("txtHidden").value =="false") is true.

--
Regards,
Amal [MCP, MCS]
http://geocities.com/techsharing


VMI said:
Thanks for the post.
I understand most of your solution, but I don't understand how the the
button Click event is linked to the javascript code (i.e. when will this
javascript code run?).

Thanks.

Amalorpavanathan Yagulasamy(AMAL)MCP said:
hi,
1. add a hidden text box named txtHidden in .aspx file.

2. in your pseudo code,

private void btnClose_Click(object sender, System.EventArgs e)
{
txtHidden.Text = "RUN MY STORED PROC";

}

3. in end of .aspx file, before </body> tag, add the following script

<script language="javascript">
if(document.all("txtHidden").value =="false")
{
if(confirm(""It's false. Do you want to make it true?")
{
window.open("myResult.aspx");
}
}

</script>
</body>
</HTML>

let me know if u have problem.
--
Regards,
Amal [MCP, MCS]
http://geocities.com/techsharing


VMI said:
I know this isn't the best group to post aspnet question, but the MS asp.net
NG hasn't been very helpful lately.
I've been trying to add a messagebox following the examples I've seen on the
web, but with no luck.
I have an aspx page where the user enters a bunch of data and clicks
'Submit'. When the user clicks on the 'Submit', I want to run an SP that
returns true/false depending on the data. If false, then my MessageBox will
pop up saying "It's false. Do you want to make it true?". If the user clicks
Ok, then I'll load "myResult.aspx".This is the pseudo-code for it:
private void btnClose_Click(object sender, System.EventArgs e)
{
bool result = "RUN MY STORED PROC";
if (result)
{
SHOW MY JAVASCRIPT MESSAGEBOX
}
}
PRIVATE VOID MESSAGEBOX()
{
IF (JAVASCRIPT MESSAGEBOX.RESULT == "OK")
{
Response.Redirect ("myResult.aspx");
}
}

I've googled this, but I haven't found too many helpful links. The ones I've
found assume too many things and they only explain how to display a
messagebox (not how to process the result).
Any help is appreciated.
 

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