Wednesday, 6 July 2011

how to call confirmation box on aspx.cs file and clicking ok button on confirmation box it will redirected another page


For displaying confirmation box
write code on aspx.cs file where u want to call confirmation box
ClientScript.RegisterStartupScript(GetType(), "jsScript", "Setconfirm();", true);

write Setconfirm() function on aspx file under <script language="javascript" type="text/javascript"></script> tag
<script language="javascript" type="text/javascript">
function Setconfirm()
{
int number = confirm(“Changes have been saved to the profile.”)
if(number)
{
window.location = "Admin_User.aspx";
</script>
----------------------------------------------------------------------------------------------------------
for displaying alert textbox only with ok button
write code on aspx.cs file where u want to call confirmation box
ClientScript.RegisterStartupScript(GetType(), "jsScript", "Setconfirm();", true);

write Setconfirm() function on aspx file under <script language="javascript" type="text/javascript"></script> tag
function Setconfirm() {
alert("Changes have been saved to the profile.");
window.location = "Admin_User.aspx";
}
</script>

No comments:

Post a Comment