Enter Key Behavior Inside GridTemplateColumn

2 posts, 0 answers
  1. Tracy
    Tracy avatar
    123 posts
    Member since:
    Nov 2010

    Posted 17 Oct 2017 Link to this post

    Hi,

    I have a RadGrid that is using EditMode="InPlace".  This grid has several RadComboBoxes in the Insert/Edit templates.  How can I make the [Enter] key work like the [Tab] key.  I would like to move focus to the next control when the user presses the enter key in the RadComboBox.

     

    Thank You

    Tracy

     

    Note:  The following code OnClientFocus="TelerikOnClientFocus" OnClientBlur="TelerikOnClientLostFocus" just changes the backcolor of the control to yellow on focus and back to white when it loses focuses.

     

     

     

     

     

    <telerik:GridTemplateColumn UniqueName="gtcStandardItem" HeaderStyle-Width ="120px"  HeaderText="Standard Item"  DataField="StandardItem">
        <ItemTemplate>       <asp:Label           ID="lblStandardItem"           runat="server" Text='<%# Eval("StandardItem") %>' /> </ItemTemplate>
        <EditItemTemplate>  
            <telerik:RadComboBox ID="rcbEditStandardItem"       runat="server" DataSourceID="SQLDS_StandardItem" DataTextField="StandardItem" DataValueField="StandardItem" Width="110px"  OnSelectedIndexChanged="rcbEditStandardItem_SelectedIndexChanged"   OnItemDataBound="rcbEditStandardItem_ItemDataBound" AutoPostBack="true" MarkFirstMatch="true" AllowCustomText="true" OnClientFocus="TelerikOnClientFocus" OnClientBlur="TelerikOnClientLostFocus" EnableVirtualScrolling="true"  ShowDropDownOnTextboxClick = "false"/>
        </EditItemTemplate>
        <InsertItemTemplate> <telerik:RadComboBox ID="rcbInsertStandardItem"     runat="server" DataSourceID="SQLDS_StandardItem" DataTextField="StandardItem" DataValueField="StandardItem" Width="110px"  OnSelectedIndexChanged="rcbInsertStandardItem_SelectedIndexChanged" OnItemDataBound="rcbInsertStandardItem_ItemDataBound" AutoPostBack="true" MarkFirstMatch="true" AllowCustomText="true" OnClientFocus="TelerikOnClientFocus" OnClientBlur="TelerikOnClientLostFocus" EnableVirtualScrolling="true"  ShowDropDownOnTextboxClick = "false"/> </InsertItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridTemplateColumn UniqueName="gtcJob" HeaderStyle-Width ="120px"  HeaderText="Job"  DataField="Job">
        <ItemTemplate>       <asp:Label           ID="lblJob"           runat="server" Text='<%# Eval("Job") %>' /> </ItemTemplate>
        <EditItemTemplate>   <telerik:RadComboBox ID="rcbEditJob"       runat="server" DataSourceID="SQLDS_Job" DataTextField="Job" DataValueField="Job" Width="110px"  OnSelectedIndexChanged="rcbEditJob_SelectedIndexChanged"   OnItemDataBound="rcbEditJob_ItemDataBound"  AutoPostBack="true" MarkFirstMatch="true" AllowCustomText="true" OnClientFocus="TelerikOnClientFocus" OnClientBlur="TelerikOnClientLostFocus" EnableVirtualScrolling="true"  ShowDropDownOnTextboxClick = "false"/> </EditItemTemplate>
        <InsertItemTemplate> <telerik:RadComboBox ID="rcbInsertJob"     runat="server" DataSourceID="SQLDS_Job" DataTextField="Job" DataValueField="Job" Width="110px"  OnSelectedIndexChanged="rcbInsertJob_SelectedIndexChanged" OnItemDataBound="rcbInsertJob_ItemDataBound" AutoPostBack="true" MarkFirstMatch="true" AllowCustomText="true" OnClientFocus="TelerikOnClientFocus" OnClientBlur="TelerikOnClientLostFocus" EnableVirtualScrolling="true"  ShowDropDownOnTextboxClick = "false"/> </InsertItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridTemplateColumn UniqueName="gtcExtra" HeaderStyle-Width ="110px"  HeaderText="Extra" DataField="Extra" >
        <ItemTemplate> <asp:Label ID="lblExtra"  runat="server"  Text='<%# Eval("Extra") %>' /> </ItemTemplate>
        <EditItemTemplate> <telerik:RadComboBox ID="rcbEditExtra"  runat="server"  DataSourceID="SQLDS_Extra" DataTextField="Extra" DataValueField="Extra" Width="90px" AutoPostBack="true" MarkFirstMatch="true" AllowCustomText="true" OnClientFocus="TelerikOnClientFocus" OnClientBlur="TelerikOnClientLostFocus" EnableVirtualScrolling="true"  ShowDropDownOnTextboxClick = "false"/> </EditItemTemplate>
        <InsertItemTemplate> <Telerik:RadComboBox ID="rcbInsertExtra"  runat="server"  DataSourceID="SQLDS_Extra" DataTextField="Extra" DataValueField="Extra" Width="90px" AutoPostBack="true" MarkFirstMatch="true" AllowCustomText="true" OnClientFocus="TelerikOnClientFocus" OnClientBlur="TelerikOnClientLostFocus" EnableVirtualScrolling="true"  ShowDropDownOnTextboxClick = "false"/> </InsertItemTemplate>
    </telerik:GridTemplateColumn>
    <telerik:GridTemplateColumn UniqueName="gtcCostCode" HeaderStyle-Width ="110px"  HeaderText="CostCode" DataField="CostCode" >
        <ItemTemplate> <asp:Label ID="lblCostCode"  runat="server"  Text='<%# Eval("CostCode") %>' /> </ItemTemplate>
        <EditItemTemplate> <telerik:RadComboBox ID="rcbEditCostCode"  runat="server"  DataSourceID="SQLDS_CostCode" DataTextField="CostCode" DataValueField="CostCode" Width="90px" MarkFirstMatch="true" AllowCustomText="true" OnClientFocus="TelerikOnClientFocus" OnClientBlur="TelerikOnClientLostFocus" EnableVirtualScrolling="true"  ShowDropDownOnTextboxClick = "false"/> </EditItemTemplate>
        <InsertItemTemplate> <telerik:RadComboBox ID="rcbInsertCostCode"  runat="server"  DataSourceID="SQLDS_CostCode" DataTextField="CostCode" DataValueField="CostCode" Width="90px" MarkFirstMatch="true" AllowCustomText="true" OnClientFocus="TelerikOnClientFocus" OnClientBlur="TelerikOnClientLostFocus" EnableVirtualScrolling="true"  ShowDropDownOnTextboxClick = "false" /> </InsertItemTemplate>
    </telerik:GridTemplateColumn>
  2. Attila Antal
    Admin
    Attila Antal avatar
    386 posts

    Posted 17 Nov 2017 Link to this post

    Hi Tracy,

    When using RadGrid with batch edit mode, you can use the following method suggested in this forum thread: open row for edit by js code in batch mode. For the other editing modes, visit the OnKeyPress documentation article describing how to capture the event when a key is pressed on the keyboard.

    Hope that helps.

    kind Regards,
    Attila Antal
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top