使用Jquery重置ascx用户控件[英] Reset ascx User control using Jquery

本文是小编为大家收集整理的关于使用Jquery重置ascx用户控件的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我正在开发一个有搜索页面的 asp.net Web 应用程序.在这个搜索页面上,我们有大约 37 个搜索过滤器控件.所有输入控件都是不同的类型,例如文本框、下拉列表(在页面加载时从数据库中填充)、单选按钮和复选框列表.
在页面的右侧,我们在 Jquery 和 Ajax 的帮助下显示了该搜索的结果.现在我为左侧搜索过滤器创建一个 .ascx 用户控件,并将所有搜索过滤器控件放在该用户控件中.这个页面对我来说很好,唯一的问题是我在那个页面上有重置搜索按钮(即在我的 ascx 控件内),我必须清除该按钮单击事件上的所有搜索过滤器控件值(记住我不想重新加载我的页面,以便我使用 Jquery).
解决方案是,我必须为所有 37 个控件编写代码以将其值重置为默认值.
是否有任何技巧或想法可以在不刷新页面的情况下从 Jquery 重置或重新加载我的用户控件.

注意:请记住,由于某种原因,我不能将更新面板放在 aspx 页面上.

请给我任何想法.

推荐答案

好问题.前段时间我尝试过这个,但在中间离开并继续使用另一种方法.

顺便说一句,此链接可能会有所帮助:

http://stackoverflow.com/questions/8386766/refresh-user-control-with-jquery[^]

你可以试试

清除页面中的所有文本框

('input[type=text]).each(function(){

本文地址:https://www.itbaoku.cn/post/1261719.html

问题描述

I am working on a asp.net web application where we have search page. On this search page we have around 37 search filter control. All Input controls are different types like some are text boxes, Dropdownlist (which filled from Database on page load), Radio buttons and check box list.
On right side of page we are showing results of that search with the help of Jquery and Ajax. Now I create a .ascx User Control for left side Search filter and put all the Search filter controls in that user control. This page works fine for me the only issue is I have on Reset Search button on that page (i.e. Inside my ascx control) and I have to clear all the search filter controls value on that buttons click event( remember I don't want to reload my page so i use Jquery).
On solution for is, i have to write code for all 37 controls to reset its value to default.
Is there any trick or idea to reset or reload my user control from Jquery without refreshing page.

Note : Remember I can't put Update panel on aspx page for some reason.

Please give me any idea.

推荐答案

Good question. I tried this some time back but left in middle and went ahead with another approach.

Btw, this link might help:

http://stackoverflow.com/questions/8386766/refresh-user-control-with-jquery[^]

you can try like

to clear all textBoxes in your page

('input[type=text]).each(function(){