This is a migrated thread and some comments may be shown as answers.

stopping uncheck of checkbox

1 Answer 87 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Robert O'Dell
Top achievements
Rank 1
Robert O'Dell asked on 06 Jul 2008, 08:32 PM
I have a page where I want to have the user confirm before unchecking (and thus doing an Ajax call to perform an undo).  I constructed a simple test that illustrates the problem I'm running, which is when the user does a confirm, the AJAX call is cancelled which is correct, but the box is unchecked.  Interestingly checking the box again acts as if the box were still checked and performs the confirm again.  I tried to set node.check() after the set_cancel to no avail.  In checking the forums I did see a post that suggested something was fixed in the latest update, which I downloaded the hotfix and the dll in the bin of the project is showing 2008.1.619.335
Can you provide some enlightenment of what I'm missing?

ASPX (note: this page does use a master page)
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">  
<script language="javascript" type="text/javascript">  
function confirmuncheck(sender, eventArgs)  
{  
    var node = eventArgs.get_node();  
    if (node.get_checked()==true)  
    {  
        var answer = confirm('Are you sure');  
        if (answer == false)  
        {  
            eventArgs.set_cancel(true);  
            //node.check();  
        }  
    }  
}  
</script> 
 
    <asp:Label ID="lbl" runat="server" ForeColor="Red"></asp:Label> 
    <telerik:RadTreeView ID="RadTreeView1" runat="server" CheckBoxes="true" OnNodeCheck="NodeChecked" 
     OnClientNodeChecking="confirmuncheck">  
    </telerik:RadTreeView> 
</asp:Content> 
 

The code behind adds in the nodes.  and the method called for the example very simply shows a message
    protected void NodeChecked(object sender, RadTreeNodeEventArgs NodeEvent)  
    {  
        RadTreeNode node = NodeEvent.Node;  
        if (node.Checked)  
        {  
            lbl.Text += " Perform task ";  
        }  
        else  
        {  
            lbl.Text += " UnDone ";  
        }  
    }  
 

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 09 Jul 2008, 09:23 AM
Hi Robert O'Dell,

This seems to be a problem with our control. We will fix it for the Q2 release scheduled for the end of this month.

In the mean time I suggest that you download the Futures build (2008.2.708) and un-comment the node.check() line in your confirmuncheck() javascript method - it will work properly.

I updated your Telerik Points for your involvement.

Kind regards,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Robert O'Dell
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or