So I have this ASP.NET form which contains TextBoxtA and TextBoxtB. I want that if I enter certain input on TextBoxA (for example '000') the TextBoxtB text value would be set to 'TextChanged' and disabled.
PS: And I want that happen right after the text di TextBoxA changes, not when onClick fired. So I use the attribute onTextChanged. According to this http://forums.asp.net/t/1300979.aspx, I have to use onChange instead and change the poperty on PageLoad on my code behind. But it can't seem to work.
So heres my code:
<script runat="server">
function changeText() {
var A = document.getElementById('<%=inputTexboxtA.ClientID%>').value;
var B = document.getElementById('<%=inputTexboxtB.ClientID%>').value;
if (A = '000') {
B = 'TextChanged';
}
}
</script>
protected void Page_Load(object sender, EventArgs e)
{
inputTexboxtA.Attributes.Add("onChange", changeText());
}
<asp:TextBox ID="inputTexboxtA" runat="server" MaxLength="3"/></td>
<asp:TextBox ID="inputTexboxtB" runat="server" MaxLength="3"/></td>
Am I doing it right? Thanks before!