2012-04-01 88 views
1

我有一個允許使用KeyboardNavigation的RadGrid,啓用了RowSelection。 Telerik RadGrid autopostback當選擇行時

當我用鼠標連續點擊,帖子後面發生,我執行我希望做一些必要的操作。

現在,當我使用鍵盤上/下鍵來改變行選擇時,網格確實改變了SelectedRow(顯示器顯示選擇發生)。但在這種情況下,控件不會回發。

任何人都知道如何通過鍵盤更改行後創建回發?

回答

-1

jai telengana

function keyPress(sender, args) { 

    if (args.get_keyCode() == 13) { 
     args.set_cancel(true); 
     if (sender._activeRow) { 
      sender._activeRow.click(); 
     } 
    } 
} 

<telerik:RadGrid ID="Manage_Group_RadGrid" AllowFilteringByColumn="true" OnItemCommand="Manage_Group_RadGrid_ItemCommand" AllowPaging="true" AllowMultiRowSelection="true" OnItemDataBound="Manage_Group_RadGrid_ItemDataBound" ShowStatusBar="true" 
    AllowSorting="true" OnDataBinding="Manage_Group_RadGrid_DataBinding" OnNeedDataSource="Manage_Group_RadGrid_NeedDataSource" GroupingEnabled="true" ShowGroupPanel="true" OnGroupsChanging="Manage_Group_RadGrid_GroupsChanging" 
    PagerStyle-AlwaysVisible="true" 
    PageSize="15" Height="440px" 
    DataKeyNames="cn" runat="server"> 
    <EditItemStyle BackColor="green" /> 
    <MasterTableView DataKeyNames="cn" AutoGenerateColumns="false" 
      PagerStyle-AlwaysVisible="true" GroupsDefaultExpanded="false" CommandItemDisplay="Top"> 
     <Columns> 
      <telerik:GridBoundColumn DataField="cn" HeaderText="cn" SortExpression="cn" UniqueName="cn" 
       ItemStyle-Width="200px" HeaderStyle-Width="200px" /> 
      <telerik:GridBoundColumn DataField="cn" HeaderText="sAMAccountName" SortExpression="sAMAccountName" UniqueName="sAMAccountName" 
       ItemStyle-Width="200px" HeaderStyle-Width="200px" /> 
     </Columns> 
     <CommandItemSettings ShowAddNewRecordButton="false" /> 
    </MasterTableView> 
    <GroupingSettings CaseSensitive="false" /> 
    <GroupingSettings ShowUnGroupButton="true"></GroupingSettings> 
    <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="false"> 
     **<ClientEvents OnKeyPress="keyPress" />** 
     <Selecting AllowRowSelect="true" /> 
    </ClientSettings> 
</telerik:RadGrid>