asp.net-ajax

Ajax.Actionlink opens in a new page

☆樱花仙子☆ 提交于 2019-12-04 01:17:19
问题 I have a partial view that needs to get loaded between two div but when the ajax.actionlink is invoked it open the content in the partial view in a new browser window. I use UpdateTargetId = "ajaxReplace" Regards 回答1: Did you include/reference all the necessary javascript files? You say you use MVC 3. If you have UnobtrusiveJavaScriptEnabled then you'll need: jQuery jquery.unobtrusive-ajax.js if you also use client side validation, you'll need; jquery.validate.js jquery.validate.unobtrusive

ASP.NET: Warning on changed data closing windows

痴心易碎 提交于 2019-12-03 22:16:23
问题 I'd like to warn users when they try to close a browser window if they didn't save the changes they made in the web form. I'm using ASP.NET 3.5 (with ASP.NET Ajax). Is there a common solution which I could easily implement? EDIT: maybe my question wasn't clear: I am specifically looking for a way which integrates gracefully in the ASP.NET Server Controls methodology. 回答1: Here is an ASP.NET extender control that will help you with this: http://www.codeproject.com/KB/ajax

Passing data into a ModalPopupExtender

落爺英雄遲暮 提交于 2019-12-03 20:57:58
I have a ModalPopupExtender that allows a customer to apply payment info. It has been working great. Then the customer asked to see the total due on the ModalPopup. This did not seem like a big deal to just take the total due from the parent control and pass it into the ModalPopup control. It seems like there is no easy way do to this. Here is my HTML code, keep in mind this code is wrapped in a UpdatePanel <asp:LinkButton ID="lnkMakePayment" runat="server" Visible="true" OnClick="lnkMakePayment_Click" > <asp:Label ID="lblMakePayment" runat="server" Text="Make Payment"/></asp:LinkButton> <asp

Internet Explorer 11 gives script error in PageRequestManager.js

时间秒杀一切 提交于 2019-12-03 16:04:43
I'm using ASP.NET 4.5 on the server and I have a .NET Windows application with a Web Browser control that navigates to the web page on the server. If I run the Windows application on a system with Internet Explorer 11, I get a script error: "Object doesn't support property or method 'attachEvent'" when navigating to another page. The script file is ScriptResource.axd so it isn't any of my scripts. I do know that Internet Explorer 11 doesn't support attachEvent anymore (replaced with attachEventListener?). That is however not of much help here, as the javascript is part of the framework, not in

Passing parameters to MVC Ajax.ActionLink

狂风中的少年 提交于 2019-12-03 15:57:29
How can I send the value of the TextBox as a parameter of the ActionLink? I need to use the Html.TextBoxFor <%= Html.TextBoxFor(m => m.SomeField)%> <%= Ajax.ActionLink("Link Text", "MyAction", "MyController", new { foo = "I need here the content of the textBox, I mean the 'SomeField' value"}, new AjaxOptions{ UpdateTargetId = "updateTargetId"} )%> The Contoller/Actions looks like this: public class MyController{ public ActionResult MyAction(string foo) { /* return your content */ } } Using MVC 2.0 How can I send the value of the TextBox as a parameter of the ActionLink? The semantically

removing history points from browser

左心房为你撑大大i 提交于 2019-12-03 15:52:21
can we remove history points created in web browser. or is it possible not add history point when a sample link "some link" is clicked and url in browser changed You cannot remove items from the browser history, but you can load a new document into the window and bypass the history with javascript. This is done with the replace() method of location objects top.location.replace( newUrl ); Browser's history belongs to the user, not to your application (client or serverside). There is no way to access it through javascript and this is a very good thing. 来源: https://stackoverflow.com/questions

Weird ASP.NET AJAX Bug / 32-bit to 64-bit

别来无恙 提交于 2019-12-03 15:17:25
I'm getting a weird error from my sites ever since upgrading to Windows 2008 64-bit. I have most of my app pools running in 64-bit mode (all but one, used for a legacy ASP.NET 1.1 application). On the sites that are running on 64-bit, I've been getting errors from ASP.NET AJAX. Exception information: Exception type: System.NotSupportedException Exception message: Assembly "AjaxControlToolkit, Version=3.0.20820.16598, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" does not contain a script with hash code "e2e86ef9". Request information: Request URL: http://site.com/page.aspx?_TSM_HiddenField

Simple Ajax in asp.net MVC 3, update the model and rerender part

ε祈祈猫儿з 提交于 2019-12-03 15:04:34
问题 I come from a more WPF application background and I'm used to bindings and such. Jumping into websites then can come with it's problems as they work so much more differently. I'm trying to do a simple Ajax action but not sure where to begin. Basically I want to make a dropdownlist that changes one property on the model and re-renders that part of the page. Perhaps this is too much of a WPF way to do this so my Model could be twisted for the thing it is supposed to do. Here is what I got

Reasons why ASP.NET AJAX would be disabled

寵の児 提交于 2019-12-03 14:05:51
I have an ASP.NET application that uses ASP.NET AJAX and the AJAX Control Toolkit. The application runs fine on all recent browsers on a PC. It also works fine on my iPad, at least the first time the application is accessed. I have found that if I shut down the iPad and return to the page later (via a bookmark or similar), the site is broken. I have narrowed down the failure to an ASP.NET/ASP.NET AJAX issue/bug/limitation, and I'm looking for some help to progress. Using Fiddler as a proxy server for the iPad, I have identified the following problems, when re-opening the page. My *.skin file

ASP.NET MVC AJAX with HTML.ValidationMessageFor

前提是你 提交于 2019-12-03 14:05:43
I'm used to the ASP.NET Webforms easy way of doing AJAX with UpdatePanels. I understand the process is much more artisanal with MVC. In a specific case, I'm using Data Annotations to validate some form inputs. I use the HTML.ValidationMessageFor helper to show an error message. If I want to use AJAX to post this form and show this error message, what would be the process? Is it possible to keep the HTML.ValidationMessageFor and make it work with AJAX? Thank you. This article might be helpful: ScottGu's blog: ASP.NET MVC 2: Model Validation . The validation used in MVC can be both client and