[Enter key] + firing item template command

2 posts, 0 answers
  1. Taiseer
    Taiseer avatar
    37 posts
    Member since:
    Oct 2007

    Posted 25 May 2010 Link to this post

    Hi All,

    I have an item template command used to filter all columns once it is clicked. what i want to do is to allow the user to click [Enter] key then the filtering event occurs (Like clicking on the item template command by mouse click), how this can be doable?
    Please find the attached image to see how the grid looks like.
    I dont want to set property Autopostbackonfilter to true for each column because i'm filtering all the columns at single command item click.

    Thanks in advance
  2. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 31 May 2010 Link to this post

    Hello Tayseer,

    You can manually attach client-side onclick event handler to the filter textboxes.
    if (e.Item is GridFilteringItem)
    {
        foreach (GridColumn column in RadGrid1.MasterTableView.AutoGeneratedColumns)
        {
            Control ctrl = (e.Item as GridFilteringItem)[column.UniqueName].Controls[0];
            if (ctrl is TextBox)
                (ctrl as TextBox).Attributes["onkeydown"] = "keyDownEventHandler(this,event)";
            ...
        }
    }

    <script type="text/javascript">
        function keyDownEventHandler(sender,arg)
        {
            arg = arg || window.event;
            if (arg.keyCode == 13)
                $telerik.findElement(document, "myFilterButton").click();
        }
    </script>

    Regards,
    Daniel
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top