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

查看:61
本文介绍了使用Jquery重置ascx用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个asp.net Web应用程序,我们有搜索页面。在这个搜索页面上,我们有大约37个搜索过滤器控件。所有输入控件都是不同的类型,例如一些是文本框,Dropdownlist(从页面加载的数据库填充),单选按钮和复选框列表。

在页面的右侧,我们显示该搜索的结果在Jquery和Ajax的帮助下。现在我为左侧搜索过滤器创建一个.ascx用户控件,并将所有搜索过滤器控件放在该用户控件中。这个页面对我来说很好,唯一的问题是我在该页面上的重置搜索按钮(即在我的ascx控件内),我必须清除那些按钮点击事件的所有搜索过滤器控件值(记住我不想重新加载我的页面,所以我使用Jquery)。

解决方案是,我必须编写所有37个控件的代码,将其值重置为默认值。

有没有任何技巧或者想要在不刷新页面的情况下从Jquery重置或重新加载我的用户控件。



注意:请记住,出于某种原因,我无法将更新面板放在aspx页面上。 />


请给我任何想法。

解决方案

好问题。我试了一段时间,但是留在中间并继续采用另一种方法。



顺便说一下,这个链接可能会有所帮助:



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


您可以尝试使用



来清除页面中的所有文本框

 


' input [type =文本])。每个(函数(){

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(){


这篇关于使用Jquery重置ascx用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆