0

I have made my three textbox disable in code behind

if(!ispostback)
{
textbox1.enabled = false;
textbox2.enabled = false;
textbox3.enabled = false;
}

then I have three checkboxes that corresponds with the three textboxes, chkbox1 for txtbox1, chkbox2 for txtbox2 and so on.

How to do enable it using javascript?

i've used this

function toggleTB()
{
var chk = document.getElementById("CheckBox1")
var txt = document.getElementById("TextBox1")

if(chk.checked)
{
txt.disabled = false;
}
else
{
txt.disabled = true;
}
}

but it's only with chkbox1 and textbox1. Do I need to make another function? I believe I can put the others within one function, how to do it?

Another question, I have made both in server side(autopostback) and javascript but it seems that the server side is being used rather than javascipt. Why is that? I though if only javascript is enabled then the server side will be executed.

2
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by AngelicOne
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.