This is a migrated thread and some comments may be shown as answers.

Enable/disable command items on row select

3 Answers 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ColinBowern
Top achievements
Rank 1
ColinBowern asked on 26 Jun 2009, 03:04 PM
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?

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 01 Jul 2009, 11:49 AM
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,
Veli
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.
0
archimede
Top achievements
Rank 1
answered on 09 Nov 2009, 02:24 PM
Hello,
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
0
Veli
Telerik team
answered on 11 Nov 2009, 08:46 AM
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.

Greetings,
Veli
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.
Tags
Grid
Asked by
ColinBowern
Top achievements
Rank 1
Answers by
Veli
Telerik team
archimede
Top achievements
Rank 1
Share this question
or