asp.net-ajax

Prevent AJAX Timer Control request from extending FormsAuthentication ticket?

。_饼干妹妹 提交于 2019-12-23 16:50:41
问题 I have a webforms app that uses a few ASP.NET AJAX Timer controls (i.e. polling). If a user is on a page with one of these, they will effectively never time-out, as the polling process keeps their authentication ticket alive. I'd like to segment Timer controls so they don't trigger Forms Authentication's RenewTicketIfOld method. The path I'm on and I've done something similar before is to inject something into the AJAX HTTP request to have these requests identified as coming from a timer and

How to pass variables in to a JS file

允我心安 提交于 2019-12-23 15:10:52
问题 I know there's an easy answer to this, but this comes in the form of 2 problems. Problem 1: In an asp.net page there is a javascript block like this: <script type="text/javascript"> function doSomethingRandom() { var myVarToUse = <asp:Literal runat="server" ID="HackyLiteral" /> } </script> Ok, so it's a simplified version of the problem, but it should be clear. I now want to move this function in to a JS file...but I can't get the asp:Literal into the JS. var myVarToUse = <asp:Literal runat=

Update label on MasterPage from content page with UpdatePanel without full Postback

北慕城南 提交于 2019-12-23 13:11:07
问题 Does there exist a solution for this scenario? I have a content page which contains an UpdatePanel and has a combobox. When the combobox value is changed I want to change a label in my Master page. So, the main problem for me is that I don't want to make a full postback with every combobox value changing. Is there some trick to overcome full postback? Thanks in advance. 回答1: Put your label in your MasterPage in a separate UpdatePanel. On dropdownlist's SelectedIndexChange make an asnychronous

ASP MVC + AJAX, trying to Update a div asynchronously

天涯浪子 提交于 2019-12-23 12:17:34
问题 I'm new to Asp MVC, and I'm trying to accomplish a little async update (I'm using MVC3 RC2, with Razor, but I can manage with ASPX solutions too). I have a Master page, which renders a shopping cart box on every page by calling Html.RenderAction("Cart","Shop"). The Cart action of the ShopController calls the database, etc, and outputs the results. This works. First problem: if I put an ActionLink in this partial view (like Html.ActionLink("Remove")), then even if I call PartialView() from the

asp.net : exclude control in updatepanel from doing async postback

孤街醉人 提交于 2019-12-23 11:36:54
问题 I have placed a user control inside update panel after doing asynchronous postback of page associated js file of that user control is not working so that is there any method to exclude a control from updatepanel in another word i don't want to post that user control. <asp:UpdatePanel ID="upPnlAnswerList" runat="server"> <ContentTemplate> // another code that required to placed inside updatepanel <div id="miancontainer" class="containerr" <klmsuc:Share ID="shareUserControl" runat="server" /> /

JavaScriptSerializer deserialize object “collection” as property in object failing

安稳与你 提交于 2019-12-23 09:32:18
问题 I have a js object structured like: object.property1 = "some string"; object.property2 = "some string"; object.property3.property1 = "some string"; object.property3.property2 = "some string"; object.property3.property2 = "some string"; i'm using JSON.stringify(object) to pass this with ajax request. When i try to deserialize this using JavaScriptSerializer.Deserialize as a Dictionary i get the following error: No parameterless constructor defined for type of 'System.String'. This exact same

AJAX POST to MVC Controller showing 302 error

一笑奈何 提交于 2019-12-23 09:22:12
问题 I want to do AJAX POST in my MVC View. I've written the following: Script Code in View $('#media-search').click(function () { var data = { key: $('#search-query').val() }; $.ajax({ type: 'POST', url: '/Builder/Search', data: JSON.stringify(data), dataType: 'json', contentType: 'application/json; charset=utf-8', success: function (data) { $('.builder').empty(); alert("Key Passed Successfully!!!"); } }); }); Controller Code [HttpPost] public ActionResult Search(string key) { return

AJAX Call to MVC5 ActionResult

允我心安 提交于 2019-12-23 05:15:12
问题 I am trying to figure out what is wrong with the following code: $(".ReportScore").click(function () { $.ajax({ type: "GET", url: "/events/Tournaments/ReportScore", success: function() { location.reload(); }, error: function() { alert("The scores were not recorded"); } }); }); When I type the url in the bar, it works without problems, however when I try to do an ajax call I get 404 Page not found error. To clarify, when I click on the button I Get a popup saying "The scores were not recorded"

AJAX.Net - UpdatePanel doesn't delete old content

女生的网名这么多〃 提交于 2019-12-23 05:12:05
问题 I'm using AJAX.Net (3.5) inside a usercontrol. The usercontrol contains an UpdatePanel, and inside the UpdatePanelthere is a MultiView. The ScriptManager is included in the page that act as container for the usercontrol. To switch between views the usercontrol contains a simple button. When I click it, the View is changed so the old content is hidden and new content is displayed. My problem is that the content isn't hidden at all. The view changes and the new content is displayed, but the old

Javascript function should be running on every page load

你说的曾经没有我的故事 提交于 2019-12-23 04:56:16
问题 I am looking at an asp.net 2 web application that I am maintaining (but did not write). Some things that should happen on the page loading do not, but only sometimes, and it seems to be if you are using Firefox 3 inside a VM. JQuery and asp.net Ajax are used. The important function that should run every time (but does not) is attached by the following Javascript: <script type="text/javascript"> //<![CDATA[ $(document).ready(function(){ Sys.Application.add_load(ImportantFunction); }); $