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

How to change PrimaryIcon at client side

1 Answer 161 Views
Button
This is a migrated thread and some comments may be shown as answers.
Barbaros Saglamtimur
Top achievements
Rank 1
Barbaros Saglamtimur asked on 10 May 2012, 01:46 PM
Hi,

I would like to change buttons PrimaryIcon at client side. I have used set_iconData(s) but no luck. It sets icon data (can get back correct values with get_iconData) but nothing changed at browser window. I have used repaint function and nothing changed either. Any thoughts?

TIA

PS:Here is my code;
var s = { "primaryIconUrl": "../images/icons/EnableConvex24.png", "primaryHeight": "24px", "primaryWidth": "24px" };
btnActivate.set_iconData(s);
btnActivate.repaint();

1 Answer, 1 is accepted

Sort by
0
Accepted
Slav
Telerik team
answered on 14 May 2012, 09:53 AM
Hello Barbaros,

If you need to change the RadButton icon on the client-side, I would suggest configuring the image via a CSS class and setting this class in the property Icon-PrimaryIconCssClass. When you want to switch the icons on the client, just remove the specified CSS class and add a new one that will set different background image.

For your convenience I have attached a sample page that demonstrates the described approach. The solution is related to the primary RadButton icon, but it can easily be applied for the secondary one via the property Icon-SecondaryIconCssClass. Please use this sample as a reference for incorporating the feature into your actual project.

Regards,
Slav
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.
Tags
Button
Asked by
Barbaros Saglamtimur
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or