GetButtonByCommand shows alert box

2 posts, 0 answers
  1. caglar_ozkul
    caglar_ozkul avatar
    111 posts
    Member since:
    Sep 2006

    Posted 23 Jun 2008 Link to this post

    Hi,

    When i use GetButtonByCommand method of toolbar it shows an alert box that says: "Cannot find a button with such command name!"

    I know there is no buttons with such name, but my buttons are being loaded dynamically.

    So i should use
    if (GetButtonByCommand("cmdSome"))
        toolbar.DisableButton(GetButtonByCommand("cmdSome"));

    So the GetButtonByCommand should return null if it can not find that button. And not alert anything i hope.

    Kind Regards,
    Caglar Ozkul
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 23 Jun 2008 Link to this post

    Hello caglar_ozkul,

    GetButtonByCommand does not produce the alert - it is DisableButton. To avoid this first check if GetButtonByCommand returns -1 and then call DisableButton:

    if (GetButtonByCommand("cmdSome") > -1)
        toolbar.DisableButton(GetButtonByCommand("cmdSome"));

    You are right that the GetButtonByCommand should have returned null when the button isn't found. We have implemented it that way in RadToolbar for ASP.NET Ajax.

    Regards,
    Albert
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top