Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 25-Jan-13 8:13am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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!
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It should read:
 
document.getElementById("ctl00_ContentPlaceHolder1_TabContainer1_TabPanel1_txt_totalfees").disabled = true;
<asp:TextBox ID="txt_totalfees" runat="server" onblur="javascript: return TotalFeesDesable()"></asp:TextBox>
  Permalink  
v8
Comments
Member 9511889 at 25-Jan-13 14:21pm
   
i have not this problem.my id is correct.
richcb at 25-Jan-13 14:28pm
   
Ok, I updated the solution. It should be what you are looking for.
Member 9511889 at 25-Jan-13 14:42pm
   
i have try this,but it is not working.
richcb at 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 at 25-Jan-13 14:52pm
   
yes
richcb at 25-Jan-13 15:25pm
   
Ok, check my updated solution again, I just got that to work.
Member 9511889 at 25-Jan-13 15:33pm
   
thanks..
richcb at 25-Jan-13 15:37pm
   
welcome...

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 446
1 OriginalGriff 380
2 Yogesh Kumar Tyagi 304
3 Prakriti Goyal 200
4 Maciej Los 165
0 OriginalGriff 6,472
1 Sergey Alexandrovich Kryukov 5,404
2 Maciej Los 3,434
3 Peter Leow 3,259
4 DamithSL 2,495


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100