Ticket Q239346
Visible to All Users

ASPxTreeList disable node selection but not invisible

created 15 years ago

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?

Comments (1)
Serge (DevExpress Support) 15 years ago

    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.

    Answers

    created 15 years ago

    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

      Show previous comments (1)

        Problem solved

        SC SC
        Sanjay Choudhary 1 9 years ago

          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

          Nastya (DevExpress Support) 9 years ago

            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.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.