Additional properties client side

8 posts, 0 answers
  1. j8
    j8 avatar
    1 posts
    Member since:
    Oct 2007

    Posted 08 Jan 2013 Link to this post

    Hi,

    Is there a way to get the CommandName and CommandArgument of a RadRibbonButton in client side script?

    I found a reference in http://www.telerik.com/community/forums/aspnet-ajax/ribbonbar/disabling-button-in-client-side-script.aspx#0
    but I'm not sure if this is server side or client side.

    Regards,
      Peter
  2. Bozhidar
    Admin
    Bozhidar avatar
    1103 posts

    Posted 09 Jan 2013 Link to this post

    Hi Peter,

    At the moment there isn't a way to get these values on the client, however we will make sure to include this functionality ( get_commandName()/get_commandArgument()/findItemByCommandName() ) in our next official release, which is due in February.
     
    Kind regards,
    Bozhidar
    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
  4. Michael
    Michael avatar
    43 posts
    Member since:
    Mar 2013

    Posted 14 Mar 2013 Link to this post

    So how do you determine which RibbonBar Button was pressed via javascript?
  5. Plamen
    Admin
    Plamen avatar
    2734 posts

    Posted 19 Mar 2013 Link to this post

    Hi Michael,

     
    You can use the OnClientButtonClicking or OnClientButtonClicked client events which point to the button clicked.

    Hope this will be helpful.

    All the best,
    Plamen
    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.
  6. Vladimir
    Vladimir avatar
    11 posts
    Member since:
    May 2013

    Posted 10 Dec 2013 Link to this post

    Hi,


    is there possibe to get and set commandname and commandargument on client side?

    I cannot see still it in new release.



    Thanks

    Vlad

  7. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Dec 2013 Link to this post

    Hi Vladimir,

    Please have a look into the following code snippet to get and set the CommandName and CommandArgument of RibbonBarButton.

    ASPX:
    <telerik:RadRibbonBar ID="RadRibbonBar1" runat="server" CssClass="demo">
        <telerik:RibbonBarTab Text="Tab2" Value="2" runat="server" ID="RibbonBarTab">
            <telerik:RibbonBarGroup>
                <Items>
                    <telerik:RibbonBarSplitButton Text="splitbutton" ID="RibbonBarSplitButton1">
                        <Buttons>
                            <telerik:RibbonBarButton ID="RibbonBarButton1" Text="Button1" CommandName="open"
                                CommandArgument="close" Value="value1" />
                            <telerik:RibbonBarButton ID="RibbonBarButton2" Text="Button2" Value="value2" />
                        </Buttons>
                    </telerik:RibbonBarSplitButton>
                </Items>
            </telerik:RibbonBarGroup>
        </telerik:RibbonBarTab>
    </telerik:RadRibbonBar>

    JavaScript:
    <script type="text/javascript">
        function pageLoad() {
            var ribbonbar = $find("<%=RadRibbonBar1.ClientID %>");
            var button1 = ribbonbar.findButtonByValue("value1");
            var button2 = ribbonbar.findButtonByValue("value2");
            button2._commandName = "check";
            button2._commandArgument = "demo";
            alert("Button1 CommandName " + button1.get_commandName());
            alert("Button1 CommandArgument " + button1.get_commandArgument());
            alert("Button2 CommandName " + button2.get_commandName());
            alert("Button2 CommandArgument " + button2.get_commandArgument());
        }
    </script>

    Thanks,
    Shinu.
  8. Vladimir
    Vladimir avatar
    11 posts
    Member since:
    May 2013

    Posted 11 Dec 2013 Link to this post

    Hi Shinu,


    thanks for reply. Getters works correctly. But I cannot set command argument on client side and receive on server. So it is not possible?



    Thank you

    Vlad

  9. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Dec 2013 Link to this post

    Hi Vladimir,

    As a work around you can set the CommandName and CommandArgument of RibbonBarButton in the HiddenField and access it in the Server Side. Please have a look into the following code snippet.

    JavaScript:
    <script type="text/javascript">
        function pageLoad() {
            var ribbonbar = $find("<%=RadRibbonBar1.ClientID %>");
            var button2 = ribbonbar.findButtonByValue("value2");
            button2._commandName = "check";
            document.getElementById("Hidden1").value = button2.get_commandName();
            button2._commandArgument = "demo";
            document.getElementById("Hidden2").value = button2.get_commandName();
        }
    </script>

    C#:
    string commandname = Hidden1.Value;
    string commandargu = Hidden2.Value;

    Thanks,
    Shinu.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017