Client-side OnRowSelecting is fired when deselecting

2 posts, 0 answers
  1. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 14 Oct 2008 Link to this post

    I've used some code that was provided by telerik to make it so users can only select a rows using the GridClientSelectColumn. Here is the javascript event.

    function CancelNonInput(sender, args)    
                {    
                    alert(1); 
                    var e = args.get_domEvent();   
                    //IE - srcElement, Others - target   
                    var targetElement = e.srcElement || e.target;   
                                 
                    //is the clicked element an input checkbox? <input type="checkbox"...>   
                    if(targetElement.tagName.toLowerCase() != "input" &&    
                        (!targetElement.type || targetElement.type.toLowerCase() != "checkbox"))  
                    {                       
                        //cancel the event   
                        args.set_cancel(true);   
                    }   
                }  

    I'm using this on the OnRowSelecting and OnRowDeselecting with this event and it has worked in the past. However, for some reason, when I use it now, it works fine when checking the checkbox, but when I deselect the box, it clears the box and reselects it again, firing off the CancelNonInput event twice. Why is it all of a sudden reselecting the column after deselecting the column.

    Thanks,

    Adam
  2. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 15 Oct 2008 Link to this post

    I found out the problem. I didn't have the AllowMultiRowSelection enabled.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top