1.Confirmation Box-JS
<asp:Button CssClass="srsbutton" ID="btnActivate" Text="Active" runat="server" Width="120px" Visible="false" OnClientClick="return confirmation();"/>
<script type="text/javascript">
function confirmation() {
if (confirm('Are you sure you want to Inacive ?')) {
return true;
} else {
return false;
}
}
</script>
2.VB.Net-Code Behind
If MsgBox("Prompt", "Are you sure you want to Inactive ?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
InActivePostDelete()
End If
3.VB.Net-Code Behind
Dim resultResponse = MsgBox("Are you sure you want to add/remove students of new order?", MsgBoxStyle.YesNo, "Prompt")
If resultResponse = MsgBoxResult.Yes Then
Page.RegisterClientScriptBlock("ChildInfo", "<script type='text/javascript'>window.open('frmChildInfo.aspx?qOrderId=" & Request.QueryString("NewOrderId") & "','_blank','width=1200,height=600,top=50px,left=100px,scrollbars=no,status=yes,resizable=false');</script>")
End If
4.using JS and call from Code Behind using Ajax ScriptManager
-----In frmViewOrder.aspx
<script type="text/javascript">
function fnConfirmARChild(NewOrderId) {
var x;
x = confirm('Are you sure you want to add/remove students of new order?')
if (x == true) {
window.open('frmChildInfo.aspx?qOrderId=' + NewOrderId, '_blank', 'width=1200,height=600,top=50px,left=100px,scrollbars=no,status=yes,resizable=false');
}
else {
return false;
}
}
</script>
-----In frmViewOrder.aspx.vb
Me.Page.RegisterStartupScript("confirm", "<script type='text/javascript'>fnConfirmARChild('" & Request.QueryString("NewOrderId") & "');</script>")
5.Show Confirm Box from GridView by setting value to HiddenField
-----frmChildInfo.aspx
<asp:HiddenField ID="hdnReturnDeleteValue" runat="server" />
<asp:Button ID="btnDeleteChild" runat="server" Text="Delete" CommandName="DeleteChild" OnClientClick="fnConfirmARChild()" CommandArgument='<%# Convert.ToString(Eval("Child_Id")) + "," + Convert.ToString(Eval("Order_Id")) %>' /></td>
<script type="text/javascript">
function fnConfirmARChild() {
var x;
x = confirm('Are you sure you want delete student from this order?')
document.getElementById('hdnReturnDeleteValue').value = false;
if (x == true) {
document.getElementById('hdnReturnDeleteValue').value = true;
return true;
}
else {
document.getElementById('hdnReturnDeleteValue').value = false;
return false;
}
</script>
-----frmChildInfo.aspx.vb
If hdnReturnDeleteValue.Value = "true" Then
ciSqlString = "uspDelete_OrderChildInfo"
SqlHelper.ExecuteNonQuery(ciSqlConnection, CommandType.StoredProcedure, ciSqlString, ciSqlParameter)
Me.Page.ClientScript.RegisterStartupScript(Me.GetType, "alert", "alert('Child Info deleted successfully.');", True)
BindChildInfoGrid()
End If
<asp:Button CssClass="srsbutton" ID="btnActivate" Text="Active" runat="server" Width="120px" Visible="false" OnClientClick="return confirmation();"/>
<script type="text/javascript">
function confirmation() {
if (confirm('Are you sure you want to Inacive ?')) {
return true;
} else {
return false;
}
}
</script>
2.VB.Net-Code Behind
If MsgBox("Prompt", "Are you sure you want to Inactive ?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
InActivePostDelete()
End If
3.VB.Net-Code Behind
Dim resultResponse = MsgBox("Are you sure you want to add/remove students of new order?", MsgBoxStyle.YesNo, "Prompt")
If resultResponse = MsgBoxResult.Yes Then
Page.RegisterClientScriptBlock("ChildInfo", "<script type='text/javascript'>window.open('frmChildInfo.aspx?qOrderId=" & Request.QueryString("NewOrderId") & "','_blank','width=1200,height=600,top=50px,left=100px,scrollbars=no,status=yes,resizable=false');</script>")
End If
4.using JS and call from Code Behind using Ajax ScriptManager
-----In frmViewOrder.aspx
<script type="text/javascript">
function fnConfirmARChild(NewOrderId) {
var x;
x = confirm('Are you sure you want to add/remove students of new order?')
if (x == true) {
window.open('frmChildInfo.aspx?qOrderId=' + NewOrderId, '_blank', 'width=1200,height=600,top=50px,left=100px,scrollbars=no,status=yes,resizable=false');
}
else {
return false;
}
}
</script>
-----In frmViewOrder.aspx.vb
Me.Page.RegisterStartupScript("confirm", "<script type='text/javascript'>fnConfirmARChild('" & Request.QueryString("NewOrderId") & "');</script>")
5.Show Confirm Box from GridView by setting value to HiddenField
-----frmChildInfo.aspx
<asp:HiddenField ID="hdnReturnDeleteValue" runat="server" />
<asp:Button ID="btnDeleteChild" runat="server" Text="Delete" CommandName="DeleteChild" OnClientClick="fnConfirmARChild()" CommandArgument='<%# Convert.ToString(Eval("Child_Id")) + "," + Convert.ToString(Eval("Order_Id")) %>' /></td>
<script type="text/javascript">
function fnConfirmARChild() {
var x;
x = confirm('Are you sure you want delete student from this order?')
document.getElementById('hdnReturnDeleteValue').value = false;
if (x == true) {
document.getElementById('hdnReturnDeleteValue').value = true;
return true;
}
else {
document.getElementById('hdnReturnDeleteValue').value = false;
return false;
}
</script>
-----frmChildInfo.aspx.vb
If hdnReturnDeleteValue.Value = "true" Then
ciSqlString = "uspDelete_OrderChildInfo"
SqlHelper.ExecuteNonQuery(ciSqlConnection, CommandType.StoredProcedure, ciSqlString, ciSqlParameter)
Me.Page.ClientScript.RegisterStartupScript(Me.GetType, "alert", "alert('Child Info deleted successfully.');", True)
BindChildInfoGrid()
End If
No comments:
Post a Comment