Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi to all,
i have 1 textbox and 2 button

2 button :- search,clear-filter.

functionality is:-

1) clear-filter always disabled.when you click search,clearfilter enabled.
2) and then if you click clear filter button again clear filter is invisible.


old code:-
here i using this below script but not working in chrome so kindly help me for that.

C#
window.onload = function Showalert() {

           var txt = document.getElementById("<%= txtSearch.ClientID %>");
           var btn = document.getElementById("<%= BtnClearFilter.ClientID %>");
           if (txt.value == "") {
               // alert(txt.value);
               btn.style.visibility = "hidden";
               // when the window is loaded, hide the button if the textbox is empty
           }

       }

       function EnableDisableButton(sender, target) {
           var first = document.getElementById('<%=txtSearch.ClientID %>');

           if (sender.value.length >= 1 && first.value.length >= 1) {
               document.getElementById('<%=BtnClearFilter.ClientID %>').style.visibility = "visible";

           }

           if (sender.value.length < 1 && first.value.length < 1) {

               document.getElementById('<%=BtnClearFilter.ClientID %>').style.visibility = "Hidden";
           }
       }



because given script or code what ever it may be it will work in ie as well as chrome
Posted
Updated 12-Jun-15 21:45pm
v2
Comments
F-ES Sitecore 13-Jun-15 15:53pm    
How is EnableDisableButton called?

use updatepanel and Visible=true/false
or
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_style_visibility
 
Share this answer
 
v2
 
Share this answer
 
Comments
JOTHI KUMAR Member 10918227 13-Jun-15 7:21am    
not work sorry here i used update panel no use :(
In javascript :

document.getElementById('<%=Button1.ClientID %>').style.visibility = "hidden";

in Jquery :

SQL
$(selector).css('visibility', 'hidden'); // Hide element
$(selector).css('visibility', 'visible'); // Show element



in C# COde Behide :
button1.visible=false;//to hide.
button1.Visible=true;//to show.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900