asp.net - Reset ascx User control using Jquery -


i working on asp.net web application have search page. on search page have around 37 search filter control. input controls different types text boxes, dropdownlist (which filled database on page load), radio buttons , check box list. on right side of page showing results of search of jquery , ajax. create .ascx user control left side search filter , put search filter controls in user control. page works fine me issue have on reset search button on page (i.e. inside ascx control) , have clear search filter controls value on buttons click event( remember don't want reload page use jquery). on solution is, have write code 37 controls reset value default. there trick or idea reset or reload user control jquery without refreshing page.

note : remember can't put update panel on aspx page reason.

please give me idea.

you can use input type selector minimal code ie. $(':input') select text box field. if want clear controls on current form have written small plugin can use it:

$.fn.clearform = function () {     return this.each(function () {         var type = this.type, tag = this.tagname.tolowercase();         if (tag == 'form' || tag == 'div')              return $(':input', this).clearform();         if (type == 'text' || type == 'password' || tag == 'textarea')             this.value = '';         else if (type == 'checkbox' || type == 'radio')             this.checked = false;         else if (tag == 'select')             this.selectedindex = -1;     }); }; 

usage:

$('#divid').clearform(); $('.div_class').clearform(); $('form').clearform(); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -