I have a jQuery Autocomplete field on an ASP.Net Webform and everything has been working great until now. I also have a DropDownList that I have a need to fire onSelectedIndexChanged with AutoPostBack.

我在ASP.Net Webform上有一个jQuery Autocomplete字段,到目前为止一切都运行良好。我还有一个DropDownList,我需要使用AutoPostBack触发onSelectedIndexChanged。

When I changed my code to do the AutoPostBack, the text field that has the jQuery AutoComplete on it comes back blank. However, if I look at the source of the page, the text is in the text field. If I now post the form, the page will send back a blank field. My Google-Fu is weak on this one, as I could not come up with any workaround for it.

当我更改我的代码以执行AutoPostBack时,其上包含jQuery AutoComplete的文本字段将返回空白。但是,如果我查看页面的来源,则文本位于文本字段中。如果我现在发布表单,页面将发回一个空白字段。我的Google-Fu在这方面很弱,因为我无法提出任何解决方法。

Has anyone had any issues like this with the Autocomplete field getting blanked out on an AutoPostBack, and how did you get around it?

有没有人在AutoPostBack上自动填充字段被删除时出现这样的问题,你是如何解决这个问题的?

I can post code if it's really necessary, but I'd need to sanitize a lot of it before I could due to company policy.

如果确实有必要,我可以发布代码,但是由于公司政策的原因,我需要先对其进行清理。

2 个解决方案

#1


How is the autocomplete field being initialized? Is it being set to empty string either on page load from server or by the autocomplete jQuery plugin on document.ready?

如何初始化自动完成字段?是从服务器页面加载还是通过document.ready上的自动完成jQuery插件设置为空字符串?

If the source code for the plug-in is setting the textbox to empty string on document.ready then try the following:

如果插件的源代码将文本框设置为document.ready上的空字符串,请尝试以下操作:

// Store current textbox value in a var
var temp = $('#mytextbox').val();

// Initialize the autocomplete plugin (winging it on the syntax)
$('#mytextbox').autocomplete();

// Reset the value of the textbox.
$('#mytextbox').val(temp);

更多相关文章

  1. 如何在MVC4中使用type= " url "而不用jQuery将字段验证为url ?
  2. js限制文本框只能输入数字方法
  3. html中文本域选中后会出现蓝边框
  4. 使用表单字段值定制CSS属性。
  5. 使用换行符将textarea的文本复制到div中
  6. 9.1.4 前端 - HTML body标签 - 标题,段落,分割线,换行,特殊符号,列
  7. 更改所选文本的背景颜色,HTML JQUERY
  8. 在PHP中获取幕布元素ID的文本[重复]
  9. Server.Htmlencode用于文本域显示带的html代码

随机推荐

  1. android断点下载器案例
  2. [转]Android(安卓)Music和第三方应用
  3. Android之如何解决Android studio运行出
  4. 安卓开发之实现下角圆形按钮
  5. 编程回忆之Android回忆(Android 调用短信
  6. Android(安卓)Studio 多渠道打包及 gradl
  7. Android(安卓)判断 网络连接 Internet访
  8. xmlns:android 命名空间
  9. 详细解读Android中的搜索框(四)—— Search
  10. Android 圆角输入框