• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2839
  • Last Modified:

Display a message box in ASP.Net 3.5

Hi,
I know this should be easy enough with javascript but i am failing miserably!
I want to display a choice message box to a user - Yes or No and continue on processing based on the button has clicked. It is not linked to the event of any control.

Can anyone help?

Many THANKS
0
Cause
Asked:
Cause
2 Solutions
 
Loganathan NatarajanLAMP DeveloperCommented:
0
 
CauseAuthor Commented:
Thanks loqudotcom. I don't have any event to link the javascript to. I am processing somecode and based on results i get back from the database i want to ask the user a question. if i understand the example correctly that it linked to an event. I just want to call it from vb.net
0
 
sm394Commented:
Just as discussed by logudotcom but in aspx

<asp:Button  runat="server" ID="test" OnClientClick="return confirm('Are you sure?');" Text="Test" />
0
 
sm394Commented:
If (your expresion to text)
{
     ClientScript.RegisterStartupScript(this.GetType(), "selectnodealert", @"<script type=""text/javascript"">confirm('please confirm ');</script>");

 
}
0
 
TimCotteeCommented:
Hello Cause,

The simple answer is you can't simply stop your code-behind processing, throw a client-side message box and then continue processing just like that. You need to adapt the techniques already described and modify your behind-the-scenes processing to handle the fact that when you need to ask the question you need to end your processing script in the client-side message box, add a handler to this that responds to the option selected and then posts back to your code to continue (if appropriate) or cancel the existing processing.

It is an oft-asked question but there is no way around breaking out of your code and back to the client-side.

Regards,

TimCottee
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now