asp.net-ajax

ASP.NET MVC and Ajax, concurrent requests?

会有一股神秘感。 提交于 2019-11-26 18:45:53
AJAX newbie here! At the moment in my ASP.NET MVC web app my AJAX requests appear to be getting batched or queued, im not sure. No requests seem to be getting completed until the previous request has finished. How do I go about getting the requests to return independantly? I dont necessarily want someone to give me the answer but maybe some links to good tutorials or resources which could help. Thanks I'm expanding on Lachlan Roche's answer, which is correct. The ASP.NET framework will "single-thread" requests that deal with Session scope (a global resource), to prevent one request from

Are MicrosoftAjax.js, MicrosoftMvcAjax.js and MicrosoftMvcValidation.js obsolete as of ASP.NET MVC 3?

好久不见. 提交于 2019-11-26 18:40:19
Are MicrosoftAjax.js , MicrosoftMvcAjax.js and MicrosoftMvcValidation.js obsolete as of ASP.NET MVC 3? I haven't been able to find much info on this on the web, but from what I've read it implies that these files were used in ASP.NET MVC 1-2, and were replaced by jquery.validate.min.js , jquery.unobtrusive-ajax.min.js and jquery.validate.unobtrusive.min.js . Is that correct? Do I still need the Microsoft files? Darin Dimitrov Yes, all Microsoft* helpers are obsolete in ASP.NET MVC 3. For me they have always been obsolete but now at least Microsoft made this official and replaced them with

How to send a model in jQuery $.ajax() post request to MVC controller method

天大地大妈咪最大 提交于 2019-11-26 18:36:08
In doing an auto-refresh using the following code, I assumed that when I do a post, the model will automatically sent to the controller: $.ajax({ url: '<%=Url.Action("ModelPage")%>', type: "POST", //data: ?????? success: function(result) { $("div#updatePane").html(result); }, complete: function() { $('form').onsubmit({ preventDefault: function() { } }); } }); Every time there is a post, I need to increment the value attribute in the model: public ActionResult Modelpage(MyModel model) { model.value = model.value + 1; return PartialView("ModelPartialView", this.ViewData); } But the model is not

Sys is undefined

ぐ巨炮叔叔 提交于 2019-11-26 17:31:09
I have an ASP.Net/AJAX control kit project that i am working on. 80% of the time there is no problem. The page runs as it should. If you refresh the page it will sometimes show a javascript error "Sys is undefined". It doesn't happen all the time, but it is reproducible. When it happens, the user has to shut down their browser and reopen the page. This leads me to believe that it could be an IIS setting. Another note. I looked at the page source both when I get the error, and when not. When the page throws errors the following code is missing: <script src="/ScriptResource.axd?d

What's the different between ASP.NET AJAX pageLoad() and JavaScript window.onload?

微笑、不失礼 提交于 2019-11-26 15:55:28
问题 I'm working with ASP.NET AJAX and want to understand the difference between these two snippets: function pageLoad(sender, eventArgs) { } and window.onload = function() { } Do they act the same? Or is one called before the other? Or will one be called automatically and the another not? 回答1: A couple things to note first. MS invented a sort of "clientside runtime object" called Sys.Application. It handles raising init , load , and unload events throughout the [clientside] lifespan of the page,

Serialize Entity Framework objects into JSON

…衆ロ難τιáo~ 提交于 2019-11-26 15:49:15
It seems that serializing Entity Framework objects into JSON is not possible using either WCF's native DataContractJsonSerializer or ASP.NET's native JavaScript serializer. This is due to the reference counting issues both serializers reject. I have also tried Json.NET , which also fails specifically on a Reference Counting issue. Edit: Json.NET can now serialize and deserialize Entity Framework entities . My objects are Entity Framework objects, which are overloaded to perform additional business functionality (eg. authentication, etc.) and I do not want to decorate these classes with

Full postback triggered by LinkButton inside GridView inside UpdatePanel

試著忘記壹切 提交于 2019-11-26 15:39:28
问题 I have a GridView inside of a UpdatePanel. In a template field is a button I use for marking items. Functionally, this works fine, but the button always triggers a full page postback instead of a partial postback. How do I get the button to trigger a partial postback? <asp:ScriptManager ID="ContentScriptManager" runat="server" /> <asp:UpdatePanel ID="ContentUpdatePanel" runat="server" ChildrenAsTriggers="true"> <ContentTemplate> <asp:GridView ID="OrderGrid" runat="server" AllowPaging="false"

How to post ASP.NET MVC Ajax form using JavaScript rather than submit button

对着背影说爱祢 提交于 2019-11-26 12:03:43
问题 I have a simple form created using Ajax.BeginForm : <% using (Ajax.BeginForm(\"Update\", \"Description\", new { id = Model.Id }, new AjaxOptions { UpdateTargetId = \"DescriptionDiv\", HttpMethod = \"post\" },new {id =\'AjaxForm\' })) {%> Description: <%= Html.TextBox(\"Description\", Model.Description) %><br /> <input type=\"submit\" value=\"save\" /> <% }%> The controller is wired up and returns a partial view that updates the DescriptionDiv . And it all works neatly. Now I would like to be

Reset scroll position after Async postback - ASP.NET

一个人想着一个人 提交于 2019-11-26 11:08:12
问题 What is the best way to reset the scroll position to the top of page after the an asynchronous postback? The asynchronous postback is initiated from a ASP.NET GridView CommandField column and the ASP.NET update panel Update method is called in the GridView OnRowCommand. My current application is an ASP.NET 3.5 web site. EDIT: I have received excellent feedback from everyone, and I ended using the PageRequestManager method in a script tag, but my next question is: How do I configure it to only

How to use Ajax.BeginForm MVC helper with JSON result?

那年仲夏 提交于 2019-11-26 10:36:08
问题 I\'m trying to use the ASP.NET MVC Ajax.BeginForm helper but don\'t want to use the existing content insertion options when the call completes. Instead, I want to use a custom JavaScript function as the callback. This works, but the result I want should be returned as JSON. Unfortunately, the framework just treats the data as a string. Below is the client code. The server code simply returns a JsonResult with one field, UppercaseName. <script type=\'text/javascript\'> function onTestComplete