【问题标题】:Telerik RadGrid autopostback when row is selectedTelerik RadGrid 选择行时自动回发
【发布时间】:2012-04-01 00:01:32
【问题描述】:

我有一个允许 KeyboardNavigation 并启用 RowSelection 的 RadGrid。

当我使用鼠标单击一行时,回发发生并且我执行我希望执行的必要操作。

现在,当我使用键盘上/下键更改行选择时,网格确实会更改 SelectedRow(显示屏显示正在发生的选择)。但在这种情况下,控件不会回发。

有人知道如何在键盘更改一行后创建回发吗?

【问题讨论】:

    标签: telerik-grid


    【解决方案1】:

    杰泰伦加纳

    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>
    

    【讨论】:

      猜你喜欢
      • 2012-01-13
      • 1970-01-01
      • 1970-01-01
      • 2012-01-21
      • 1970-01-01
      • 1970-01-01
      • 2011-08-18
      • 1970-01-01
      • 2017-02-20
      相关资源
      最近更新 更多