1

I've got several pages with UpdatePanels with asp textboxes and submit buttons inside. However, none of them trigger Chrome or Safari's autofill/autocomplete functions, where things you've previously entered gets suggested.

It seems to work fine with regular postbacks, but inside UpdatePanels I can't seem to get this to work.

It would seem to me that this should be a known problem, but I can't find any information about it.

Joakim Johansson
  • 3,196
  • 1
  • 27
  • 43
  • You said "but inside UpdatePanels I can't seem to get this to work" What do you mean? I understand that the page don't postback, but which event are you trying to raise? – DavRob60 May 02 '11 at 15:33
  • 1
    Well the page does postback, but the browser doesn't seem to recognize it as a "submit". So where the browser would collect data I've previously submitted, and suggest it again when typing in the field, it doesn't collect anything at all. In other browsers such as Firefox or IE9 this data is collected just fine. But in webkit browsers such as Chrome or Safari, it's not recognized as an actual submit of data, sort of. – Joakim Johansson May 03 '11 at 11:45
  • 1
    Are you sure that the update panel is working properly in the webkit browsers? I've heard of people having problems with that: http://lesson8.blogspot.com/2011/11/update-panel-not-working-in-google.html – Steven Hunt Sep 21 '12 at 11:57
  • Hmm, well, other than the autocomplete thing, I haven't had any problems with it. – Joakim Johansson Sep 23 '12 at 11:49
  • @StevenHunt: Tried the solution you linked to just now, and no, autocomplete/autofill still doesn't work in Chrome. – Joakim Johansson Sep 24 '12 at 08:38

4 Answers4

1

It seems like Chrome is remembering those input values when there is a full post/submit event. Here is two other question in SO regarding the same issue.

browser autocomplete/saved form not work in ajax request and How to store to browser auto-complete/auto-fill when using AJAX calls instead of standard form submit

I tried to fake a submit to another page with get action and "NoContent" status code so that chrome would remember the values. No luck with that too. If it would work it would still not be a good way to do this though.

Community
  • 1
  • 1
Yiğit Yener
  • 5,796
  • 1
  • 23
  • 26
0

Have you tried changing the UpdateMode property?

DP.
  • 51
  • 5
0

I think you're experiencing a classic problem with ASP.NET UpdatePanel controls and jQuery.

The problem is the following:

jQuery code (in your case it's auto-complete, but it can be anything) works fine on the page load, but it stops working after a partial postback. If this is the case, there is a couple of things you need to understand about using jQuery with UpdatePanel controls.

First, all event bindings defined in $(document).ready stop working after the first partial postback (and I assume that your button click causes a partial postback). This is just the way ASP.NET works. So how do you fix it?

Well, there are several ways to address this problem. A typical recommendation is to substitute $(document).ready with the ASP.NET AJAX's own pageLoad event. This may solve one problem, but it will most likely cause more issues because now you will be binding events on every partial postback causing repeated execution of event handlers on a single event. You can address some issues by calling unbind for your selector before performing any bindings. For simple event bindings, you can keep using $(document).ready with the live function (instead of click, hover, etc).

I haven't used jQuery plugins with UpdatePanel, so I can't say for sure what you need to do, but once you understand what is happening, it should not be hard to find the right approach. To learn more about this problem and possible solutions, please read Dave Ward's article $(document).ready() and pageLoad() are not the same! (the article includes several examples).

Hope this might help!

Ahsan Khurshid
  • 9,383
  • 1
  • 33
  • 51
  • Hmm, no, I think you're misunderstanding the question (Which is entirely my fault, since I can't find a common definition for the behaviour I'm trying to describe). The problem is the information that the browser saves when you input something in a field with a button of type "submit". Then when you type something else into it, your browser (not the website, as would be the case of jQuery autocomplete) gives you a list of previous inputs. That information is not stored for some reason in webkit browsers, when using an update panel. – Joakim Johansson Sep 27 '12 at 07:18
0

I had the same issue identified by OP. However, cause was different than other answers here.

My issue was that the postbacks triggered by an <asp:LinkButton> were not being picked up as a form submit by the browser.

Example:

<asp:LinkButton runat="server" OnClick="codebehind_function">Click here</asp:LinkButton>

Adding the PostBackUrl attribute fixed it!

<asp:LinkButton runat="server" OnClick="codebehind_function" PostBackUrl="#">Click here</asp:LinkButton>

Vince
  • 31
  • 1