我有一个允许使用KeyboardNavigation的RadGrid,启用了RowSelection。
当我使用鼠标点击一行时,回发后我会执行我想要做的必要操作。
现在,当我使用键盘上/下键来更改行选择时,网格确实会更改SelectedRow(显示屏会显示正在进行的选择)。但在这种情况下,控件不会回发。
有人知道如何在键盘更改行后创建回发吗?
答案 0 :(得分:-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>