如何在telerik radgrid中双击时执行服务器端代码?

时间:2013-06-13 15:20:17

标签: telerik postback radgrid

如何在telerik radgrid中双击执行服务器端代码?我的radgrid上有一个radbutton执行服务器端代码,我想在一行上双击以执行相同的代码。

<script type="text/javascript">
    function RowDblClick(sender, eventArgs) {
        // do post back? find button and call the click function?
    }
</script>

<telerik:RadGrid ID="RadGrid1" runat="server">
    <ClientSettings>
        <ClientEvents OnRowDblClick="RowDblClick" />
    </ClientSettings>
    <MasterTableView CommandItemDisplay="Top">
        <CommandItemTemplate>
            <telerik:RadButton ID="EditRadButton" runat="server" Text="Edit" />
        </CommandItemTemplate>
    </MasterTableView>
</telerik:RadGrid>

1 个答案:

答案 0 :(得分:1)

获取网格,然后获取其子项按钮,然后调用单击

function RowDblClick(sender, eventArgs) {
    var grid = $get('<%= RadGrid1.ClientID %>');
    var button = $telerik.findControl(grid, "EditRadButton");
    button.click();
}