I want to disable selection check-boxes of some of the nodes in a tree list but not hide the check-boxes using TreeListNode.AllowSelect. I search on web and I am now using the following code to disable the boxes:
protected void tree_HtmlRowPrepared(object sender, TreeListHtmlRowEventArgs e)
{
…
if (e.RowKind == TreeListRowKind.Data)
{
if (/*conditions*/)
{
// disabled selection
foreach (TableCell cell in e.Row.Cells)
{
if (cell is DevExpress.Web.ASPxTreeList.Internal.TreeListSelectionCell)
{
(cell as DevExpress.Web.ASPxTreeList.Internal.TreeListSelectionCell).Enabled = false;
break;
}
}
}
}
…
}
However, I found that this is work for only IE but not for Firefox, Opera, Google Chrome. Is the above method not a desirable way to achieve my expectation?
ASPxTreeList disable node selection but not invisible
Answers
Hello Jacob,
Thank you for the code. Actually only IE allows to disable cells in a table. That is why your code works slightly incorrectly. To get the checked input element and to disable it, please try the following code:
C#foreach(TableCell cell in e.Row.Cells) {
if(cell is DevExpress.Web.ASPxTreeList.Internal.TreeListSelectionCell)
(cell.Controls[0] as WebControl).Enabled = false;
}
Thanks,
Vest
I am having the same issue and when I use the same solution but it doesn't work for me… it gets disabled but still able to select unselect the checkbox. Is the issue is with my version I am using 15.1.7 ?
Fast reply is appreciated.
Than You in advance
Hello,
We detected that you posted the same question in the ticket T349425. We will post our answer there. We kindly ask you to avoid posting duplicated issues in the future. This will save time and will allow us to process your inquiries in the most efficient manner.
Hi Jacob,
We need some time to discuss this task with our developers. Please bear with us.
Thanks,
Serge
P.S. By the way, it seems you're using an older build of our components (according to the report's Version field). Please visit our version info page, to learn about the most recent versions of our products, and obtain instructions on how to update them.