No PostBack For OnClientClick On GridView Button
-
I have been attempting to add a Confirmation Popup to a Button that comes from a ButtonField in a GridView. I have successfully identified the Button and added the Javascript with the code below. When I press the Button, a Confirmation Popup comes up with the "Ok" or "Cancel" buttons as usual. The problem is that when I press the "Ok" button….no post back is made. I can't figure it out. Is there some kind of special consideration that I missed with adding this kind of confirmation to a Button from a ButtonField? Private Sub gv_MaterialGrpLegacy_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv_MaterialGrpLegacy.RowDataBound ... Dim RowButton As Button RowButton = e.Row.Cells(0).Controls(0) RowButton.OnClientClick = String.Format("javascript:return confirm('Are You Sure You Want To Remove This {0}?');", "") Thanks to all that have help me in the past, and those who can help me with this!
-
I have been attempting to add a Confirmation Popup to a Button that comes from a ButtonField in a GridView. I have successfully identified the Button and added the Javascript with the code below. When I press the Button, a Confirmation Popup comes up with the "Ok" or "Cancel" buttons as usual. The problem is that when I press the "Ok" button….no post back is made. I can't figure it out. Is there some kind of special consideration that I missed with adding this kind of confirmation to a Button from a ButtonField? Private Sub gv_MaterialGrpLegacy_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv_MaterialGrpLegacy.RowDataBound ... Dim RowButton As Button RowButton = e.Row.Cells(0).Controls(0) RowButton.OnClientClick = String.Format("javascript:return confirm('Are You Sure You Want To Remove This {0}?');", "") Thanks to all that have help me in the past, and those who can help me with this!
I am using this, and its working fine.
With Regards, Mayank Prajapati MCP, MCTS Module Leader JCTWeb India www.jctweb.com
-
I have been attempting to add a Confirmation Popup to a Button that comes from a ButtonField in a GridView. I have successfully identified the Button and added the Javascript with the code below. When I press the Button, a Confirmation Popup comes up with the "Ok" or "Cancel" buttons as usual. The problem is that when I press the "Ok" button….no post back is made. I can't figure it out. Is there some kind of special consideration that I missed with adding this kind of confirmation to a Button from a ButtonField? Private Sub gv_MaterialGrpLegacy_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv_MaterialGrpLegacy.RowDataBound ... Dim RowButton As Button RowButton = e.Row.Cells(0).Controls(0) RowButton.OnClientClick = String.Format("javascript:return confirm('Are You Sure You Want To Remove This {0}?');", "") Thanks to all that have help me in the past, and those who can help me with this!
i am using this and its working fine With Regards, Mayank Prajapati MCP, MCTS Sr. Software Engineer JCTWeb India www.jctweb.com
-
I have been attempting to add a Confirmation Popup to a Button that comes from a ButtonField in a GridView. I have successfully identified the Button and added the Javascript with the code below. When I press the Button, a Confirmation Popup comes up with the "Ok" or "Cancel" buttons as usual. The problem is that when I press the "Ok" button….no post back is made. I can't figure it out. Is there some kind of special consideration that I missed with adding this kind of confirmation to a Button from a ButtonField? Private Sub gv_MaterialGrpLegacy_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv_MaterialGrpLegacy.RowDataBound ... Dim RowButton As Button RowButton = e.Row.Cells(0).Controls(0) RowButton.OnClientClick = String.Format("javascript:return confirm('Are You Sure You Want To Remove This {0}?');", "") Thanks to all that have help me in the past, and those who can help me with this!
michaelastewartmas wrote:
Dim RowButton As Button RowButton = e.Row.Cells(0).Controls(0) RowButton.OnClientClick = String.Format("javascript:return confirm('Are You Sure You Want To Remove This {0}?');", "")
Try binding 'Click' or 'Command' event to button which executes on the server when button is clicked. e.g. - RowButton.Click += new EventHandler(this.RowButton_Click);
-
I have been attempting to add a Confirmation Popup to a Button that comes from a ButtonField in a GridView. I have successfully identified the Button and added the Javascript with the code below. When I press the Button, a Confirmation Popup comes up with the "Ok" or "Cancel" buttons as usual. The problem is that when I press the "Ok" button….no post back is made. I can't figure it out. Is there some kind of special consideration that I missed with adding this kind of confirmation to a Button from a ButtonField? Private Sub gv_MaterialGrpLegacy_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv_MaterialGrpLegacy.RowDataBound ... Dim RowButton As Button RowButton = e.Row.Cells(0).Controls(0) RowButton.OnClientClick = String.Format("javascript:return confirm('Are You Sure You Want To Remove This {0}?');", "") Thanks to all that have help me in the past, and those who can help me with this!