Display A Confirm Box from a CodeBehind Page and Take Input Yes or No for further use.
-
Hi all, Can anyone suggest me how to write the confirm box in code behind and i want to get the return value whether the user clicked 'ok' or 'cancel', Depending on that i need to process further using if else
koushiksaha wrote:
Can anyone suggest me how to write the confirm box in code behind
Same way that your are doing using
JavaScript
. But Register that function from codbehind usingClientScript.RegisterStartupScript(this.GetType(), "Confirm", "Confirm('" + Are You Sure ?+ "');");
or if use ajax in your page thenScriptManager
instate of ClientScriptcheers, Abhijit My Recent Article : Beginner's Guide To View State
-
Hi all, Can anyone suggest me how to write the confirm box in code behind and i want to get the return value whether the user clicked 'ok' or 'cancel', Depending on that i need to process further using if else
koushiksaha wrote:
how to write the confirm box in code behind
You can't run a confirm box to branch the code in your code behind, obviously. If you're trying to confirm a button press, for example, then you put javascript directly in your aspx, and you call your javascript method in your OnClientClick. If OnClientClick returns false, then the OnClick is not called. If it returns true, then the OnClick is called.
Christian Graus Driven to the arms of OSX by Vista.
-
koushiksaha wrote:
Can anyone suggest me how to write the confirm box in code behind
Same way that your are doing using
JavaScript
. But Register that function from codbehind usingClientScript.RegisterStartupScript(this.GetType(), "Confirm", "Confirm('" + Are You Sure ?+ "');");
or if use ajax in your page thenScriptManager
instate of ClientScriptcheers, Abhijit My Recent Article : Beginner's Guide To View State
you can use Ajax confirm button extender for your situation when you will press ok it will run codebehind function related to that control.... using registerstartupscript it can display confirm message box in code behind but this script does not return any value so you cannot handle it using that....
umerumerumer