asp.net-ajax

Does Session timeout reset on every request

前提是你 提交于 2019-11-27 03:51:02
问题 Does Session timeout reset on every request regardless of whether we check sessions variables? Or we should use atleast one session variables? Does Ajax request cause resetting session timeout? like Update Panel , jQuery ajax ,... thanks Edit 1) Does HTTP Get cause resetting session timeout?? 回答1: yes, it does. it doesn't matter whether you actually use the Session or not. However, if you're using only ajax calls, you might run into some problems. (although I haven't encountered it myself,

How do I make a Textbox Postback on KeyUp?

给你一囗甜甜゛ 提交于 2019-11-27 03:50:58
I have a Textbox that changes the content of a dropdown in the OnTextChanged event. This event seems to fire when the textbox loses focus. How do I make this happen on the keypress or keyup event? Here is an example of my code <asp:TextBox ID="Code" runat="server" AutoPostBack="true" OnTextChanged="Code_TextChanged"> <asp:UpdatePanel ID="Update" runat="server"> <ContentTemplate> <asp:DropDownList runat="server" ID="DateList" /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Code" /> </Triggers> </asp:UpdatePanel> So in the codebehind, I bind the dropdown on page load. The

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

喜欢而已 提交于 2019-11-27 03:41:32
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(content) { var result = content.get_data(); alert(result.UppercaseName); } </script> <% using (Ajax

RegisterClientScriptBlock within AJAX method call

夙愿已清 提交于 2019-11-27 02:20:29
问题 I am trying to RegisterClientScriptBlock in a method that is only called via an AJAX call. It doesn't appear to actually register the script on the page and I'm guessing this is because it's not actually reloading the entire page. Is there any way to register javascript on a page from within an ajax method call? protected void MyMethod(object sender, EventArgs e) { // This method only called via AJAX call Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "resize", "alert('here');",

How do I wait for a JavaScript __doPostBack call through Selenium and WebDriver

别说谁变了你拦得住时间么 提交于 2019-11-27 02:13:43
I am facing a rare kind of issue while Automating through Selenium/Python while trying to fill out two fields on a website. My script fills out the first field i.e. ORIGIN CITY pretty fine. I have induced WebDriverWait for the second field DELIVERY ADDRESS . My guess the DELIVERY ADDRESS field is pretty much clickable even before the waiter is induced. But the ORIGIN CITY field have a JavaScript associated through onchange event as follows : onchange="javascript:setTimeout('__doPostBack(\'DrpCity\',\'\')', 0)" ORIGIN CITY HTML : <li> <div class="form-group"> <select name="DrpCity" onchange=

What's the difference between $get and $find in JavaScript?

帅比萌擦擦* 提交于 2019-11-27 02:09:00
问题 I'm a .NET programmer who've just started to learn more about client side scripting, and I was wondering sometimes you use $get('value') and $find('value') and I've discovered that these are just shortcuts for document.getElementById('value') and Sys.Application.findComponent('value'), respectively. However, I still don't understand: what is the difference between these two functions in JavaScript? What exactly are they looking up/retrieving when invoked? Thanks in advance. 回答1: $get & $find

Load partial view depending on dropdown selection in MVC3

旧街凉风 提交于 2019-11-27 01:23:01
问题 Im trying to create a from using asp.net mvc3. I have a dropdownlist with some options. What i want is different partial views to be injected into the page, depending on the selection in the dropdown list. But. i dont want this to rely on a submit action. It should function so that, the partial view is loaded as soon as you select from the select list. I have this code: @using (Ajax.BeginForm("Create_AddEntity", new AjaxOptions { UpdateTargetId = "entity_attributes", InsertionMode =

LinkButton in ListView in UpdatePanel causes full postback

半城伤御伤魂 提交于 2019-11-27 01:04:10
问题 I have a LinkButton in a ListView in an UpdatePanel. I would like the button (well, any of them) to cause a partial postback, but they are causing a full page postback. <asp:UpdatePanel ID="upOutcomes" UpdateMode="Conditional" runat="server"> <ContentTemplate> <asp:ListView ID="lvTargets" runat="server" onitemdatabound="lvTargets_ItemDataBound"> <ItemTemplate> <asp:LinkButton ID="lnkAddTarget" CssClass="lo" Text='<%# Eval("Title") + " <b>" + Eval("Level") + Eval("SubLevel") + "</b>" %>' runat

Disable asp.net button after click to prevent double clicking

旧巷老猫 提交于 2019-11-27 01:00:42
问题 I have an ASP.NET button that I need to disable after the user clicks it to prevent double-clicking. Once the submit completes it has to be enabled again. Can anyone help me with this? 回答1: Here is a solution that works for the asp.net button object. On the front end, add these attributes to your asp:Button definition: <asp:Button ... OnClientClick="this.disabled=true;" UseSubmitBehavior="false" /> In the back end, in the click event handler method call, add this code to the end (preferably

Pass data from a ASP.NET page to ASCX user controls loaded dynamically

巧了我就是萌 提交于 2019-11-27 00:51:08
问题 I'm developing an ASP.NET application with C# and Ajax. I have a page that holds user controls loaded dynamically. I need to pass some data (integer values and some strings) to the user control that has been loaded dynamically . Now I use Session to pass these values, but I think I can use another way; something like VIEWSTATE or hidden input. What do you recommend me? UPDATE: The fact that I load the controls dynamically is important because controls are loaded on every postback, and I can't