Solved

Asp.net RegisterClientScriptBlock

Posted on 2011-02-25
8
733 Views
Last Modified: 2012-05-11
I am calling this javascript from my asp.net. Can some one please let me know how i can catch whether user select Ok or cancel and do something?
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "showmessage", "confirm('" + strmsg + "');", true);
i want to know whether the use click Ok or cancel and do if Ok return and Cancel nothing
0
Comment
Question by:Angela4eva
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 28

Expert Comment

by:strickdd
ID: 34982827
if(confirm(' + strmsg + ')){ MyFunctionOnSuccess() }
0
 

Author Comment

by:Angela4eva
ID: 34983244
where should i put this line?
0
 
LVL 28

Expert Comment

by:strickdd
ID: 34984219
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "showmessage", "if(confirm(' + strmsg + ')){ MyFunctionOnSuccess() };", true);
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:Angela4eva
ID: 34984395
I want to execute the next step if ok, otherwise(Cancel) I want to  return.
I do not want to call a function.
0
 
LVL 28

Accepted Solution

by:
strickdd earned 250 total points
ID: 34984926
What is "the next step". You asked how to implement a confirm box and know whether the users selects OK or Cancel... that's what I gave you.
0
 

Author Comment

by:Angela4eva
ID: 34985049
next step is next line after
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "showmessage", "if(confirm(' + strmsg + ')){ MyFunctionOnSuccess() };", true);
even the your script form does not work.
0
 
LVL 4

Assisted Solution

by:Tuyau2poil
Tuyau2poil earned 250 total points
ID: 34993559
Well, you can't run client side code (for example javascript messagebox) and get immediate result in code behind because code behind is server side.
code behind need a postback to read client input, so code excution must stop and page reload before continuing.... impossible in this case to run code, ask something to user, and continue execution.
Only Javascript can do it, but javascript is not code behind....
I hope my explanation is not too tricky... I'm French and my english is in beta test !
0
 

Author Closing Comment

by:Angela4eva
ID: 35195419
tahnks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question