I've done it today with a client script. You can place this snippet at the
botton of the page or within a funcion you call when you want. You can write
it in the aspx file or render it exactly where you want.
this is a sample, hope it helps:
<script language="javascript">
<!--
var inputs = document.getElementsByTagName("INPUT");
var selects = document.getElementsByTagName("SELECT");
for (var i = 0;i<inputs.length;i++)
{
if ( (inputs[i].type == "text") && (inputs[i].disabled) )
{
inputs[i].disabled = false;
inputs[i].readOnly = true;
inputs[i].className = "Normal";
inputs[i].tabIndex = -1;
}
}
for (var i = 0;i<selects.length;i++)
{
selects[i].className = "Normal";
selects[i].tabIndex = -1;
selects[1].readOnly = true;
}
//-->
</script>
"GP" <GP@discussions.microsoft.com> wrote in message
news:C0**********************************@microsof t.com...
Is it possible to iterate through all the controls collection and make the
textboxes alone as read only.I don't see a readonly property for the
Control.Can some one help me in this context?
I want to do something like this below.But I get a message Readonly is not
valid property.
foreach (Control ctl in pnlBenefits.Controls)
{
if (ctl is TextBox)
ctl.ReadOnly=false;
}