Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 26, 2007 11:52 AM by NC01
Member
30 Points
70 Posts
Dec 26, 2007 01:28 AM|LINK
Halo All
I try to disable checkboxlist using vbscript :
document.all.checkboxlist.Enabled = true
but i got error saying : Object doesn't support this property or method "Enabled"
Can anyone help me?
Thanks in advanced
checkbox list vbscript
All-Star
24182 Points
3719 Posts
Dec 26, 2007 01:52 AM|LINK
Assuming checboxlist is the id of the control, try this code
checkboxlist.style.display="none";
Dec 26, 2007 01:58 AM|LINK
Please understand that i want to do it client side using vbscript.
And i want to set the enable property of checkboxlist to true or false
Not setting the visibility to be hidden or not
Thanks anyway
Dec 26, 2007 02:00 AM|LINK
Yes sir I do understand that that is why I have the above code ( javascript) . There is no enabled property on html controls
Dec 26, 2007 02:10 AM|LINK
Realy???
there is no way to set the enable property from VBScript????
Dec 26, 2007 10:04 AM|LINK
Well Setting the display to none is a popular way of hiding it. Other wise some controls like text box have a property called disabled where setting it to true leaves it on the screen but grays it out
textbox.disabled=true
assuming textbox is the client id of a text box
See an example here http://www.quirksmode.org/js/disabled.html
82577 Points
15430 Posts
MVP
Dec 26, 2007 11:52 AM|LINK
Try this as a CheckBoxList renders as a <table> tag:
<script language="JavaScript"> <!-- function setCheckBoxList(enableOrDisable) { var tableRef = document.getElementById('<%= CheckBoxList1.ClientID %>');
for (var i=0; i<tableRef.rows.length; i++) { for (var j=0; j<tableRef.rows[i].cells.length; j++) { var listControl = tableRef.rows[i].cells[j].childNodes[0]; listControl.disabled = enableOrDisable; } } } // --> </script>
NC...
chayady
Member
30 Points
70 Posts
Enable / Disabled checkboxlist using vbscript
Dec 26, 2007 01:28 AM|LINK
Halo All
I try to disable checkboxlist using vbscript :
document.all.checkboxlist.Enabled = true
but i got error saying : Object doesn't support this property or method "Enabled"
Can anyone help me?
Thanks in advanced
checkbox list vbscript
Jeev
All-Star
24182 Points
3719 Posts
Re: Enable / Disabled checkboxlist using vbscript
Dec 26, 2007 01:52 AM|LINK
Assuming checboxlist is the id of the control, try this code
checkboxlist.style.display="none";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you get the answer to your question, please mark it as the answer.
chayady
Member
30 Points
70 Posts
Re: Enable / Disabled checkboxlist using vbscript
Dec 26, 2007 01:58 AM|LINK
Please understand that i want to do it client side using vbscript.
And i want to set the enable property of checkboxlist to true or false
Not setting the visibility to be hidden or not
Thanks anyway
Jeev
All-Star
24182 Points
3719 Posts
Re: Enable / Disabled checkboxlist using vbscript
Dec 26, 2007 02:00 AM|LINK
Yes sir I do understand that that is why I have the above code ( javascript) . There is no enabled property on html controls
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you get the answer to your question, please mark it as the answer.
chayady
Member
30 Points
70 Posts
Re: Enable / Disabled checkboxlist using vbscript
Dec 26, 2007 02:10 AM|LINK
Realy???
there is no way to set the enable property from VBScript????
Jeev
All-Star
24182 Points
3719 Posts
Re: Enable / Disabled checkboxlist using vbscript
Dec 26, 2007 10:04 AM|LINK
Well Setting the display to none is a popular way of hiding it. Other wise some controls like text box have a property called disabled where setting it to true leaves it on the screen but grays it out
textbox.disabled=true
assuming textbox is the client id of a text box
See an example here http://www.quirksmode.org/js/disabled.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you get the answer to your question, please mark it as the answer.
NC01
All-Star
82577 Points
15430 Posts
MVP
Re: Enable / Disabled checkboxlist using vbscript
Dec 26, 2007 11:52 AM|LINK
Try this as a CheckBoxList renders as a <table> tag:
<script language="JavaScript">
<!--
function setCheckBoxList(enableOrDisable)
{
var tableRef = document.getElementById('<%= CheckBoxList1.ClientID %>');
for (var i=0; i<tableRef.rows.length; i++)
{
for (var j=0; j<tableRef.rows[i].cells.length; j++)
{
var listControl = tableRef.rows[i].cells[j].childNodes[0];
listControl.disabled = enableOrDisable;
}
}
}
// -->
</script>
NC...