Enable/disable command items on row select

4 posts, 0 answers
  1. ColinBowern
    ColinBowern avatar
    51 posts
    Member since:
    Aug 2012

    Posted 26 Jun 2009 Link to this post

    I am attempting to enable/disable RadToolBar buttons depending on the state of row selection.  If items are selected then the buttons should be enabled, otherwise they should be disabled.  I hooked up the client-side RowSelected event and am able to determine if there are rows selected but I can't seem to find the toolbar object.  A call to $find("<% SearchResultsTools.ClientId %>") won't work because the SearchResultsTools is not a valid object at compile time.

    Any thoughts on how I can get the RadToolBar object?
  2. Veli
    Veli avatar
    2002 posts

    Posted 01 Jul 2009 Link to this post

    Hi colinbo,

    I couldn't quite catch the reason for RadToolBar not being visible in the scope in which you call

    $find("<% SearchResultsTools.ClientId %>")

    If you give us some more detail on the particular scenario you have, we might be able to better assist  you with the solution. For now, asssuming you cannot reference RadToolBar's ID from your javascript using the <% %> expressions, here is a workaround:

    Hook up to your RadToolBar's OnClientLoad event and save your sender.get_id() client-side ID in a hidden input. Now in your button click event, you should be able to reference your hidden input and read its value, giving you the client ID of RadToolBar to use with $find().

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. archimede
    archimede avatar
    103 posts
    Member since:
    Jul 2006

    Posted 09 Nov 2009 Link to this post

    I want to control the "enable/disable" state of some command button defined on a CommandItemTemplate by some LinkButton. I want that if a row is selected the edit,copy and delete linkbutton are enabled, otherwise else.
    How can I perform this, using onclient event?

    Best regards
  4. Veli
    Veli avatar
    2002 posts

    Posted 11 Nov 2009 Link to this post

    Hi archimede,

    You enable/disable LinkButtons. They are rendered as <a> (anchors) and the DOM does not provide enabling/disabling links like buttons.  You can toggle their visibility instead, or add/remove their href attribute so that they do not postback.

    You can find a small web page that demonstrates the approach you need to take. I use RadGrid's client-side OnRowSelected/OnRowDeselected events to toggle the command item buttons.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top