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.

if you wanna make arrangments from server side
use RegisterClientScript.

Could you please elaborate? This thread is not yet solved..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.