asp.net-ajax

FileUpload and UpdatePanel: ScriptManager.RegisterPostBackControl works the second time

江枫思渺然 提交于 2019-12-18 04:14:07
问题 I'm developing an ASP.NET application with C# and Visual Studio 2008 SP1. I'm using WebForms. I have an ASPX page with two UpdatePanels, one on the left that holds a TreeView and other on the right where I load dynamically user controls. One user control, that I used on right panel, has a FileUpload control and a button to save that file on server. The ascx code to save control is: <asp:UpdatePanel ID="UpdatePanelBotons" runat="server" RenderMode="Inline" UpdateMode="Conditional">

How to update a div with Ajax.BeginForm AND execute a javascript function?

戏子无情 提交于 2019-12-18 04:04:15
问题 I am updating a div with a partial view by using something like this: <% using (Ajax.BeginForm("Action", "Controller", new { id=Model.id }, new AjaxOptions { UpdateTargetId = "divId", InsertionMode = InsertionMode.InsertAfter, })) { %> and its working fine, the returned view gets appened to the div, however I now need to execute a javascript when the post is successful, so I thought: "easy, just add OnSuccess = "MyJsFunc()" " to the AjaxOptions , but after doing this, it stopped working! now

create ajax actionlink with html elements in the link text

血红的双手。 提交于 2019-12-18 03:42:26
问题 I would like to convert a link to an ajax action link. I can't figure out how to display html elements within the link text? Here is the original link: <a href="#onpageanchor" id="myId" class="myClass" title="My Title."><i class="icon"></i>Click Me</a> Here is the ajax actionlink: @Ajax.ActionLink("<i class='icon'></i>Click Me", "MyActionMethod", new { id = "testId" }, new AjaxOptions { UpdateTargetId = "mytargetid" }, new { id = "myId", @class = "myClass", title="My Title." }) the link text

Sys.Application.add_load() vs. $(document).ready() vs. pageLoad()

风流意气都作罢 提交于 2019-12-17 22:32:40
问题 I have page that has some javascript that needs to run at page load. Said javascript needs to locate the client-side component of a ServerControl, which it does with $find(). Of course, if I emit my code directly onto the page, it executes as the page is being read, and fails because nothing it depends on is yet initialized. If I put my code inside a pageLoad() function, it runs just fine, because asp.net automatically wires up an onload handler for any function named pageLoad(). The problem

ASP.NET webforms + ASP.NET Ajax versus ASP.NET MVC and Ajax framework freedom

試著忘記壹切 提交于 2019-12-17 21:53:17
问题 If given the choice, which path would you take? ASP.NET Webforms + ASP.NET AJAX or ASP.NET MVC + JavaScript Framework of your Choice Are there any limitations that ASP.NET Webforms / ASP.NET AJAX has vis-a-vis MVC? 回答1: I've done both lately, I would take MVC nine times out of ten. I really dislike the implementation of the asp.net ajax controls, I've run into a lot of issues with timing, events, and debugging postback issues. I learned a lot from http://encosia.com/2007/07/11/why-aspnet-ajax

Asp.NET MVC AjaxOptions OnSuccess fires.. too early?

回眸只為那壹抹淺笑 提交于 2019-12-17 18:41:02
问题 I'd like to use the OnSuccess option of AjaxOptions passed as Ajax.BeginForm argument to "do something" once the response is completely received and DOM updated. As far as I can undestand from MSDN, this is what this option do. In my application, OnSuccess script fires too early, immediately after the request is sent. I put to sleep the thread for a while, to better see the result. I supposed to see the OnSuccess script (an alert) fired after that sleep time, say, 2 seconds. I use Firebug to

Pros and cons of MS Ajax vs. jQuery in an ASP.NET MVC app?

纵然是瞬间 提交于 2019-12-17 15:44:45
问题 Now that RC1 is out I need to decide once and for all whether to use MS Ajax libraries or just jQuery for AJAX requests. The application is a new application. Essentially the way I'll decide is whether or not i get any significant benefit from the Microsoft libraries that I wouldn't get from jQuery. I already HAVE jQuery loading and I am concerned about the extra overhead of file size more than anything. As far as I'm aware -- the only benefit really is that there are helpers like Ajax

How do I force full post-back from a button within an UpdatePanel?

不打扰是莪最后的温柔 提交于 2019-12-17 10:30:59
问题 How do I force full post-back from a button within an UpdatePanel? 回答1: You can use the Triggers property of the UpdatePanel to register actions that trigger a full postback. Add a PostBackTrigger object to that property, containig the ControlID of the control which needs to trigger a full postback. <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server"> <ContentTemplate> ... </ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="myFullPostBackControlID" /> <

jQuery Dialog-Postback but UpdatePanel doesn't get updated

限于喜欢 提交于 2019-12-17 09:55:32
问题 i want to show a jQuery UI Dialog from Codebehind and need to refresh it after postbacks. The dialog is a control to filter and find data. So the user selects from DropDownLists and enters text in TextBoxes, clicks a "Apply-Button", an asynchronous postback happens, the data gets filtered according to the user's selection and the result will be shown in a GridView. Therefore i need to update the UpdatePanel around the GridView. The asynchronous postback works with help from these links:

Pagemethods in asp.net

寵の児 提交于 2019-12-17 07:37:32
问题 My Pagemethod implementation is not working in Chrome browser. I have ASP.NET 3.5 web application developed in VS 2008. The code below not working in chrome or Safari: function FetchDataOnTabChange(ucName) { PageMethods.FetchData(ucName, OnSuccessFetchDataOnTabChange, OnErrorFetchDataOnTabChange); } function OnErrorFetchDataOnTabChange(error) { //Do something } function OnSuccessFetchDataOnTabChange(result) { //Do something } 回答1: This should work in all browsers by following the steps below: