Splitter to Show/Hide Command Item Template on Rad Grid

2 posts, 0 answers
  1. Mark
    Mark avatar
    64 posts
    Member since:
    Nov 2009

    Posted 08 Nov 2011 Link to this post

    Hi,

    I would like to use a Rad Splitter to show and hide the Command Item Template.

    The functionality would be sililar to this example:
    http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandsplitterresizing/defaultcs.aspx?product=splitter

    Please advise if this is possible.


    Thanks in advance,

    Ryan
  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 11 Nov 2011 Link to this post

    Hi Matt,

    RadGrid does not offer the required functionality out of the box. Nevertheless, you can achieve the required result by having a custom buttons outside the grid (in this case in the other RadPane) to and manually fire the grid commands using the MaterTableView's fireCommand() client-side method, e.g:
    <telerik:RadSplitter ID="RadSplitter1" runat="server" Orientation="Horizontal">
        <telerik:RadPane ID="gridPane" runat="server">
            <telerik:RadGrid ID="RadGrid1" runat="server">
            </telerik:RadGrid>
        </telerik:RadPane>
        <telerik:RadSplitBar CollapseMode="Both" ID="RadSplitBar2" runat="server" EnableResize="True">
        </telerik:RadSplitBar>
        <telerik:RadPane ID="commandsPane" runat="server" CssClass="TextStyle" BackColor="#d9eeff">
            <asp:Button Text="Add New Item" runat="server" ID="Button1" OnClientClick="fireGridCommand('InitInsert', ''); return false;" />
            <asp:Button Text="Refresh" runat="server" ID="Button2" OnClientClick="fireGridCommand('InitInsert', ''); return false;" />
        </telerik:RadPane>
    </telerik:RadSplitter>
     
    <script type="text/javascript">
        function fireGridCommand(commandName, commandArgument)
        {
            var masterTableView = $find("RadGrid1").get_masterTableView();
            masterTableView.fireCommand(commandName, commandArgument);
        }
    </script>


    More detailed information regarding this method is available in the following help article:
    http://www.telerik.com/help/aspnet-ajax/grid-gridtableview-firecommand.html

    Kind regards,
    Dobromir
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top