asp.net-ajax

ASP.NET AJAX using UpdatePanels

只谈情不闲聊 提交于 2019-12-10 23:35:03
问题 Conceptually, my understanding of AJAX is requests sent to the server asynchronously aka in parallel. When I use multiple UpdatePanels on a page and trigger multiple async postbacks (say by using a button), I notice that the second request is not started till the first one is complete. However when I use JQuery ajax and use PageMethods / WebMethods , my requests are processed in parallel. Why is there a discrepency in the way ASP.NET AJAX behaves? Also, when I click the button in the

Any way to use ASP.NET AJAX when my server does not and can not have the ASP.NET AJAX extensions Installed?

蓝咒 提交于 2019-12-10 23:07:48
问题 I have a server with .Net 2.0 sp1 installed and have no ability to install the AJAX extensions on the server. Is there anyway I could work around this to incorporate ASP.NET AJAX functionality? 回答1: You don't need to install the AJAX extensions into the server's GAC. You can locally reference System.Web.Extensions.dll from your applications BIN folder....I've done it half a dozen times. Copy that DLL to your projects local bin. Reference it from your project. Remember to deploy the DLL when

Accessing ToolKitScriptManager/ScriptManager from custom control

不羁的心 提交于 2019-12-10 22:08:34
问题 I'm writing a custom class library that contains custom controls (not user controls). I have some embedded javascript files that need to be registered on the page. Now since this is a class library, how do I detect whether or not to use a ToolKitScriptManager or ScriptManager? Page.ClientScript is a ClientScriptManager, but would I do if the page has the new ToolKitScriptManager? 回答1: You can determine if the page your control is being instantiated in is using a ScriptManager by calling the

Select item in CascadingDropDown via JavaScript & invoke update

杀马特。学长 韩版系。学妹 提交于 2019-12-10 21:51:49
问题 In code-behind I can do this to select something: // Select item in first DropDownList myCascadingDropDown_1.SelectedValue = itemValue_1+":::"+itemText_1; // Select item in second DropDownList myCascadingDropDown_2.SelectedValue = itemValue_2+":::"+itemText_2; How can I do this in JavaScript? (I'm aware, that I could search the list and set the selectedIndex property for each dropdown, but I have many items and i'm very lazy.) EDIT: npups answer works: I can select my desired item in the

How to assign ASP.NET hidden field value to JavaScript variable?

隐身守侯 提交于 2019-12-10 21:48:37
问题 Following is the code snippets taken from http://pietschsoft.com/post/2011/09/09/Tag-Editor-Field-using-jQuery-similar-to-StackOverflow.aspx // pre-selected tags values: [ 'javascript', 'css', 'jquery']; I want to assign values with some hidden field or C# variable, please help as I don't have expertise with JavaScript/jQuery. 回答1: You can create a public property and use it in your HTML like the following... C# (Added per/comments) public string Choices { get; set; } protected void Page_Load

Div as Ajax.ActionLink

前提是你 提交于 2019-12-10 21:11:35
问题 Is it possible to create Ajax.ActionLink which has instead of text, the whole DIV? I'd like to map div on Ajax.ActionLink 回答1: I don't think that this will work using the standard MVC Ajax scripts. I believe that the MVC javascript is created to use an <a> element by default. On a different note, embedding a div tag within an <a> is not valid XHTML. What are you trying to achieve? Using Jquery is probably the easiet way you want to go. As an example: <div onclick="SomeAjaxFunction()">some div

Ajax.BeginForm that can redirect to a new page and pass route value

人盡茶涼 提交于 2019-12-10 20:24:28
问题 This link shows how to redirect an @Ajax.BeginForm but not how to pass a route value to the new view. Ajax.BeginForm that can redirect to a new page page/9391267#9391267 How would you redirect an @Ajax.BeginForm with a route value? The equivalent of return RedirectToAction("Edit", new { id = acntId }; 回答1: It's no different, just use the Url helper overload with the route values: return Json(new { url = Url.Action("Checkout", new { id = accntId } ) }); 来源: https://stackoverflow.com/questions

Scroll to top of page after ASP.Net Ajax Async-Postback without JQuery

只愿长相守 提交于 2019-12-10 19:51:42
问题 I need to scroll to the top of the page after an Async Postback in an update panel. I've tried a couple of methods, and while they all scroll to the top of the page, they all get "overriden" by ASP.Net Ajax which returns the page to where it was when the postback occurs. I have already set MaintainScrollPositionOnPostBack="false" in the Page directive. 回答1: Have you tried window.scrollTo(0, 0); ? If you have, perhaps combine in with setTimeout window.setTimeout("window.scrollTo(0, 0)", 3000);

ASP.NET AJAX 4.0 client side databinding

不羁岁月 提交于 2019-12-10 19:27:35
问题 I read some articles in MSDN magazine about new features in ASP.NET AJAX 4.0 - primarily client side data binding. I feel MSDN magazine sometimes contains a lot of "marketing" so I'm interested in opinions of real developers. Does it worth it? Do you plan to use it? Edit: Here are links for articles if anybody is interested. But at the moment it looks like dying framework for enthusiasts only. Data binding in ASP.NET AJAX 4.0 Conditional rendering in ASP.NET AJAX 4.0 Live databinding in ASP

How to limit year in ajax calendar extender

一世执手 提交于 2019-12-10 19:25:23
问题 I have a Calendar Extender. I want to show only current year in calendar. User can not select 2010 as current year is 2011. So how to do this ? 回答1: Use the StartDate and EndDate properties to set a range of acceptable dates that you want to allow the user to select - you can set this in the markup as per krolik's answer, or in the code-behind so you can set it to the current year e.g. CalendarExtender.StartDate = new DateTime(DateTime.Today.Year,1,1); CalendarExtender.EndDate = new DateTime