Click here to Skip to main content
12,896,953 members (52,284 online)
Rate this:
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()


<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
Please Sign up or sign in to vote.

Solution 2

First, you have to use proper control ID - check Control.ClientID property:[^]

Second, the correct DOM property is "disabled"; enabled is WebForm's property!
Rate this: bad
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>
Member 9511889 25-Jan-13 14:21pm
i have not this id is correct.
richcb 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.
richcb 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
richcb 25-Jan-13 15:25pm
Ok, check my updated solution again, I just got that to work.
Member 9511889 25-Jan-13 15:33pm
richcb 25-Jan-13 15:37pm

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170424.1 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2017
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