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

[Enter key] + firing item template command

1 Answer 11 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Taiseer
Top achievements
Rank 1
Taiseer asked on 25 May 2010, 07:17 PM
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

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 31 May 2010, 11:35 AM
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.
Tags
Grid
Asked by
Taiseer
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or