<html>
<head runat="server">
<title>Yes No Confirmation box from server side in asp.net using C#</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<script type="text/javascript">
function Confirm() {
if (confirm("Do you want to delete Row?")) {
document.getElementById("hiddenval").value = "Yes";
} else {
document.getElementById("hiddenval").value = "No";
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:HiddenField ID="hiddenval" runat="server" />
<div class="col-md-12">
<div class="col-md-6">
<asp:GridView ID="gvcustomers" AutoGenerateColumns="false" CssClass="table table-bordered" runat="server">
<Columns>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="lblUserID" Text='<%#Eval("userId")%>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label Text='<%#Eval("Username")%>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Role">
<ItemTemplate>
<asp:Label ID="lblrole" Text='<%#Eval("role")%>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Created Date">
<ItemTemplate>
<asp:Label Text='<%#Eval("CreatedDate")%>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<asp:LinkButton Text="Delete" OnClick="onDelete" OnClientClick="Confirm()" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</form>
</body>
</html>