How to disable a asp:TextBox with javascript???
-
Hi, js + asp.net drive me crazy!!! i want to disabel / enabel a asp:Textbox via java... but, it doesent work :-( sampel: <!-- function make() { document.GetElementById('ctl00_MainPlaceHolder1_TextBox1').disabled = true; // desen´t working document.GetElementById('ctl00_MainPlaceHolder1_TextBox1').enabled = false; document.GetElementById('TextBox1').disabled = true; // Element not exist ... } //--> >input id="myCB" type="checkbox" onclivk="make()"... <asp:TextBox ID="TextBox1" ... what make I wrong????? thx</x-turndown>
-
Hi, js + asp.net drive me crazy!!! i want to disabel / enabel a asp:Textbox via java... but, it doesent work :-( sampel: <!-- function make() { document.GetElementById('ctl00_MainPlaceHolder1_TextBox1').disabled = true; // desen´t working document.GetElementById('ctl00_MainPlaceHolder1_TextBox1').enabled = false; document.GetElementById('TextBox1').disabled = true; // Element not exist ... } //--> >input id="myCB" type="checkbox" onclivk="make()"... <asp:TextBox ID="TextBox1" ... what make I wrong????? thx</x-turndown>
I would consider using JQuery, http://jquery.com/[^]
I know the language. I've read a book. - _Madmatt
-
Hi, js + asp.net drive me crazy!!! i want to disabel / enabel a asp:Textbox via java... but, it doesent work :-( sampel: <!-- function make() { document.GetElementById('ctl00_MainPlaceHolder1_TextBox1').disabled = true; // desen´t working document.GetElementById('ctl00_MainPlaceHolder1_TextBox1').enabled = false; document.GetElementById('TextBox1').disabled = true; // Element not exist ... } //--> >input id="myCB" type="checkbox" onclivk="make()"... <asp:TextBox ID="TextBox1" ... what make I wrong????? thx</x-turndown>
document.GetElementById('ctl00_MainPlaceHolder1_TextBox1')
should bedocument.getElementById('ctl00_MainPlaceHolder1_TextBox1')
ThegetElementById
starts with small letter. This might be your problem. usedisabled = true / false
; Cheers.Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NET -
document.GetElementById('ctl00_MainPlaceHolder1_TextBox1')
should bedocument.getElementById('ctl00_MainPlaceHolder1_TextBox1')
ThegetElementById
starts with small letter. This might be your problem. usedisabled = true / false
; Cheers.Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Windows7 API Code Pack
Simplify Code Using NDepend
Basics of Bing Search API using .NETthanks for the answers... but it not a syntax problem... in my question is a write error... sorry... this is the right source code: function enableField() { alert('sdf'); document.getElementById('ctl00_MainPlaceHolder1_TextBox1').disabled = false; } hmmm..... i dont know.... f*** js
-
Hi, js + asp.net drive me crazy!!! i want to disabel / enabel a asp:Textbox via java... but, it doesent work :-( sampel: <!-- function make() { document.GetElementById('ctl00_MainPlaceHolder1_TextBox1').disabled = true; // desen´t working document.GetElementById('ctl00_MainPlaceHolder1_TextBox1').enabled = false; document.GetElementById('TextBox1').disabled = true; // Element not exist ... } //--> >input id="myCB" type="checkbox" onclivk="make()"... <asp:TextBox ID="TextBox1" ... what make I wrong????? thx</x-turndown>
i think you should also try document.form1.txt1.readOnly=true; hope this will work for you