the below code is working if I call in button OnclientClick But not working if I call in gridview SelectedIndexChanged event
function Confirm()
{
var confirmValue = document.createElement("INPUT");
confirmValue.type = "hidden";
confirmValue.name = "confirm_value";
if (confirm("Process Staring ?"))
{
confirmValue.value = "Yes";
document.forms[0].appendChild(confirmValue);
}
else
{
confirmValue.value = "No";
document.forms[0].appendChild(confirmValue);
}
}
Controls.Add(new LiteralControl("<script type='text/javascript'>return Confirm();</script>"));
string confirmValue = Request.Form["confirm_value"];
if (confirmValue == "Yes")
{
ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('Yes')</script>");
}
else
{
ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('No')</script>");
}