Click here to Skip to main content
15,860,972 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
i have textbox.when i enter value in textbox and goto another textbox using tab,this textbox disabled.for this i have use javascript in .js file like this..
function TotalFeesDesable()
{
document.getElementById("ctl00_ContentPlaceHolder1_TabContainer1_TabPanel1_txt_totalfees").Enabled=false;

}


and

<asp:TextBox ID="txt_totalfees" runat="server" onblur="TotalFeesDesable()"></asp:TextBox>


but it is not working.what is problem in my code?
Posted

First, you have to use proper control ID - check Control.ClientID property: http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid.aspx[^]

Second, the correct DOM property is "disabled"; enabled is WebForm's property!
 
Share this answer
 
It should read:

document.getElementById("ctl00_ContentPlaceHolder1_TabContainer1_TabPanel1_txt_totalfees").disabled = true;

ASP.NET
<asp:TextBox ID="txt_totalfees" runat="server" onblur="javascript: return TotalFeesDesable()"></asp:TextBox>
 
Share this answer
 
v8
Comments
Member 9511889 25-Jan-13 14:21pm    
i have not this problem.my id is correct.
Richard C Bishop 25-Jan-13 14:28pm    
Ok, I updated the solution. It should be what you are looking for.
Member 9511889 25-Jan-13 14:42pm    
i have try this,but it is not working.
Richard C Bishop 25-Jan-13 14:44pm    
Ok, let me ask you this. Are you sure you are causing the "onblur" event to be fired in order for your function to run?
Member 9511889 25-Jan-13 14:52pm    
yes

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