Tag: webmethod

如何访问静态Web方法内的页面控件?

我已经使用jQuery使用静态WebMethod方法调用了一个代码隐藏方法。 该Web方法调用是成功的,但当试图访问文本框控件时,它是给出错误。 非静态字段,方法或属性需要对象引用。 [WebMethod] public static Savedata() { //code to insert data to DB //after inserting data successfully i need to change the text box text like following. txtStatus.Text="Data Received"; }

尝试使Web方法asynchronous

我目前正在使用的项目涉及使用会话variables的MS SQL Server和ASP.net Web服务。 显然这会导致客户端的调用按顺序执行。 我想确保这些方法asynchronous执行。 在做了一些研究之后,我认为最好的方法是使用跟踪会话(使用guid说)的表以及每个会话的单独表来保持会话状态在数据库中。 在我直接介入这个之前,我需要知道如果我configurationSQL Server来存储会话,是否可以获得Web服务的asynchronous操作。 我可以吗 ?

使用JavsScript从客户端调用服务器端的非静态方法

如何在客户端使用javascript(aspx)….在服务器端(aspx.cs)调用非静态方法….? 据我所知,我可以从客户端在服务器端调用静态方法… 服务器端: [WebMethod] public static void method1() { } 客户端: <script language="JavaScript"> function keyUP() { PageMethods.method1(); } </script> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"> </asp:ScriptManager> 有用。 现在我该如何从客户端调用非静态方法?

Ajax处理中的“JSON基元无效”

我得到一个来自jQuery的ajax调用错误。 这是我的jQuery函数: function DeleteItem(RecordId, UId, XmlName, ItemType, UserProfileId) { var obj = { RecordId: RecordId, UserId: UId, UserProfileId: UserProfileId, ItemType: ItemType, FileName: XmlName }; var json = Sys.Serialization.JavaScriptSerializer.serialize(obj); $.ajax({ type: "POST", url: "EditUserProfile.aspx/DeleteRecord", data: json, contentType: "application/json; charset=utf-8", dataType: "json", async: true, cache: false, success: function(msg) { if (msg.d != null) { RefreshData(ItemType, msg.d); } […]

在ASP.NET WebForms中使用jQuery调用“WebMethod”

我在下面的WebMethod设置了一个断点,但是我从来没有碰到过断点。 CS: [WebMethod] public static string search() { return "worked"; } ASPX: function search() { $.ajax({ type: "POST", url: "ProcessAudit/req_brws.aspx/search", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { alert(msg) } }); } <button id = "btnSearch" onclick = "search()" >Search</button>