Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hi to all,
Here i want to enable or disable the button while typing the text in text-box. here i done above task using this script. but that fire only once when pageload, if i done any process like searching or some think then it will not fire that script. how to fire that script after done some functionality (i.e) searching ,adding,editing like that
Posted
Comments
Member 10823239 18-Feb-15 0:11am    
Coming this error Value was either too large or too small for an Int32.while data Row updating in Gridview
JOTHI KUMAR Member 10918227 18-Feb-15 0:12am    
what????
[no name] 18-Feb-15 0:32am    
Hi,are u using updatepanel?
JOTHI KUMAR Member 10918227 18-Feb-15 0:39am    
no
JOTHI KUMAR Member 10918227 18-Feb-15 0:44am    
javascript:-

window.onload = function () {

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

Button:
<asp:Button ID="btnSearch" runat="server" Text="" CssClass="ButtonSearch6" EnableTheming="false" />

<asp:Button ID="BtnClearFilter" runat="server" OnClick="BtnClearFilter_Click" EnableTheming="false" Text="" CssClass="ClearFilter" />

here using this above script and then i have two button.one for search and another for clearbutton.

if i run my page it works fine ,but after i searching any one record then it will not fire,it always disable.

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