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)
The code behind adds in the nodes. and the method called for the example very simply shows a message
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 "; |
} |
} |