PDA

View Full Version : [CLOSED] how to change button's icon in 2.0



Fahd
Jul 12, 2012, 4:36 PM
Hi,
Can you please show me how to change a button's icon using javascript? My code below is not working -"Object doesn't support this property or method". "setIconClass" used to work in 1.4 and now I am trying to use setIconCls but the debugger does not show that it is a method/property.
Can you please show me which method/property is used for changing a button's icon using js?

below is my code:


<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Ext.Net Example</title>
<script type="text/javascript">
var change = function () {
Ext.net.ResourceMgr.registerIcon(["Anchor"]);
Button1.setIconCls("icon-anchor");
Button1.setTooltip({ text: "Client tooltip" });
}
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Button ID="Button1" runat="server" Text="Test" Icon="Accept">
<QTipCfg Text="Some tooltip" />
</ext:Button>

<ext:Button runat="server" Text="Change (clien-side)">
<Listeners>
<Click Fn="change" />
</Listeners>
</ext:Button>
</form>
</body>
</html>

Daniil
Jul 12, 2012, 8:04 PM
Hi,

Please use

App.Button1
instead of

Button1

The "App" is the default Namespace.

Or <ext:XScript> and #{} syntax.

Fahd
Jul 12, 2012, 8:59 PM
Thanks! That was it.


Hi,

Please use

App.Button1
instead of

Button1

The "App" is the default Namespace.

Or <ext:XScript> and #{} syntax.