protected void btnclick(object sender,Eventargs e)
{
// Here my class with Yes/No script will be called based on the condition, after user select Yes I need to execute my code
}
My script in a class file
StringBuilder strScript = new StringBuilder();
strScript.Append("");
strScript.Append("");
strScript.Append("");
strScript.Append("");
Can some one help me.

Sunny SharmaPosted Jun 4, 2013, 6:42 AM
onClientClick="return myJSFunc();" onClick="btn_click"
In this case, if myFunc() returns true then only "btn_click" gets executed, otherwise the execution stops. No postBack would be made at this point if a false is returned by the JS function.
Hope it helps!
Thanks.
Dorababu MekaPosted Jun 4, 2013, 2:32 AM
Protected void btnclick(object sender,EventArgs e)
{
// The javascript class return true
if(true) // this should be from javascript class which I create as separate class
{
// code needs to be executed will this works as per ur given sugggestion
}
}
Sunny SharmaPosted Jun 4, 2013, 2:12 AM
How about returning true/false from this code block:
-----------------------------
strScript.Append("if(result=='Yes')");
strScript.Append("{");
strScript.Append("alert('One cup of coffee coming right up!')"); // Here Instead of alert I need to pass a value to form something like true or false
strScript.Append("}");
-------------------------------
as
-------------------------------
strScript.Append("if(result=='Yes')");
strScript.Append("{");
strScript.Append("return true;"); // Here Instead of alert I need to pass a value to form something like true or false
strScript.Append("}");
--------------------------------
Hope it helps!
Happy Coding :)
Thanks.