Я хочу, чтобы вызвать веб-метод Server в href ссылки на файл asmx..любая помощь будет appericate
//Код На Стороне Сервера
[System.Web.Services.Атрибутом webmethod]
общественности статической строки вызова метода deleterow(int идентификатор пользователя)
{
string strmsg = строка.Пустой;
string ConStr = ConfigurationManager.ConnectionStrings["SqlCon"].Параметр connectionString;
SqlConnection con = новый SqlConnection(ConStr);
SqlCommand cmd = new SqlCommand("удалить из tblUser, где MemberId=" + UserId, con);
против.Открыть();
//cmd.параметры.AddWithValue("@Empid", empid);
int retval = cmd.Метод executenonquery();
против.Закрывать();
если (retval == 1)
strmsg = "true";
еще
strmsg = "false";
возврат strmsg;
}
--------------------------------------------------
\кнопка \ссылка веб-сервиса
sb.Append("\"<a href="/KB/answers/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>
Что я уже пробовал:
sb.Append("\"<a href="/KB/answers/ViewUserList.aspx"?UserId=" + result.MemberId + "' onclick = 'DeleteRow()' ><span class='fa fa-trash'></a>\"");