//Server Side Code
[System.Web.Services.WebMethod]
public static string DeleteRow(int UserId)
{
string strmsg = string.Empty;
string ConStr = ConfigurationManager.ConnectionStrings["SqlCon"].ConnectionString;
SqlConnection con = new SqlConnection(ConStr);
SqlCommand cmd = new SqlCommand("delete from tblUser where MemberId=" + UserId, con);
con.Open();
//cmd.Parameters.AddWithValue("@Empid", empid);
int retval = cmd.ExecuteNonQuery();
con.Close();
if (retval == 1)
strmsg = "true";
else
strmsg = "false";
return strmsg;
}
--------------------------------------------------
\\webservice link button
sb.Append("\"<a href='ViewUserList.aspx?UserId=" + result.MemberId + "' ><span class='fa fa-trash'></a>\"");
--------------------------------------------------
<table class="table table-striped table-bordered table-hover dataTables-example" id="tblData">
<thead>
<tr>
<%--<th style="display:none;" >MemberId</th>--%>
<th>UserName</th>
<th>Email</th>
<th>Phone</th>
<th>Role</th>
<th>Edit</th>
<th><asp:LinkButton ID="btnDelete" Text="Delete Emp" runat="server" OnClientClick="DeleteConfirmbox(this.id);"></asp:LinkButton></th>
<asp:HiddenField ID="hdnMemberId" runat="server" Value='<%#Eval("MemberId") %>'></asp:HiddenField>
</tr>
</thead>
</table>
What I have tried:
sb.Append("\"<a href='ViewUserList.aspx?UserId=" + result.MemberId + "' onclick = 'DeleteRow()' ><span class='fa fa-trash'></a>\"");