Hi,
When i press cancel button in confirm box, then also my codes executes on Gridview RowCommand, how to avoid if i press cancel button.
<asp:GridView ID="gridData" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" class="table table-striped table-bordered"
OnRowDataBound="OnRowDataBound" Visible="False" AllowPaging="true" PageSize="5" OnPageIndexChanging="OnPaging" PagerStyle-CssClass="gridfooter">
<Columns>
<asp:ButtonField ButtonType="Image" CommandName="XYZ" HeaderText="ABC" ImageUrl="~/images/123.png">
<HeaderStyle ForeColor="Red" />
</asp:ButtonField>
</Columns>
<PagerSettings PageButtonCount="15" />
<PagerStyle CssClass="gridfooter"></PagerStyle>
</asp:GridView>
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Cells(0).Attributes("onclick") = "return confirm('Are you sure want to send SMS?');"
End If
Protected Sub gridData_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gridData.RowCommand
If e.CommandName = "XYZ" Then
ltrCustID.Text = gridData.DataKeys(e.CommandArgument).Value
SendSlip(ltrCustID.Text)
End If
End Sub