JSFiddle - React, Tailwind, and code Playground
HTML
<button id= "btn" onClick="" >Delete</button>
JavaScript
// protected void grdBooks_RowDataBound(object sender, GridViewRowEventArgs e)
// {LinkButton lb = (LinkButton)e.Row.FindControl("LinkButton2");
// lb.Attributes.Add("onclick", "return confirm('Are you //sure to delete book " + DataBinder.Eval(e.Row.DataItem, "IName") + //"');");
//}
// instead of return confirm call this function
// After click on delete button it goes to web method with your itemid then you can delete or do what ever your operation
function showConfirm(itemId)
{
var result = confirm('Are your sure want to delete this?');
if(result == true)
{
// this is ajax method call
// url is your page url and method is you need to create // new web method, finally we send item id to web method
//
// refer this page http://www.aspsnippets.com/Articles/Calling-ASPNet-WebMethod-using-jQuery-AJAX.aspx
$.ajax(
{
type: 'Get',
url:'yourPage.aspx/WebMethod',
data : '{itemId : "' + itemId + '"}',
success : function(data)
{
alert('data');
},
error : function(xhr)
{
alert(xhr.responseText);
}
});
}
}