PDA

View Full Version : [CLOSED] MVC - Register an Icon



thchuong
Sep 10, 2014, 10:06 AM
Hi there,

I need to register an icon. Could you please tell me how to do that? I've tried as so


X.ResourceManager.RegisterIcon(Icon.LockOpen)

but not working.

Thanks in advance.

Daniil
Sep 10, 2014, 2:34 PM
Hi @thchuong,

Please clarify where exactly do you call this code?

thchuong
Sep 11, 2014, 11:05 AM
hi Daniil,

I called it in Razor

Daniil
Sep 11, 2014, 4:45 PM
It appears to be working with the test case below.

Example #1

<!DOCTYPE html>
<html>
<head>
<title>Ext.Net.MVC v2 Example</title>
</head>
<body>
@Html.X().ResourceManager()

@{
X.ResourceManager.RegisterIcon(Icon.LockOpen);
}

@Html.X().Button().Text("LockOpen").IconCls("icon-lockopen")
</body>
</html>

Though, it might be better to use

Ext.Net.MVC.MvcResourceManager.RegisterGlobalIcon( Icon.LockOpen);

Example #2

@{
Ext.Net.MVC.MvcResourceManager.RegisterGlobalIcon( Icon.LockOpen);
}

<!DOCTYPE html>
<html>
<head>
<title>Ext.Net.MVC v2 Example</title>
</head>
<body>
@Html.X().ResourceManager()

@Html.X().Button().Text("LockOpen").IconCls("icon-lockopen")
</body>
</html>


There are some client side approaches as well:
http://forums.ext.net/showthread.php?21847&p=94316&viewfull=1#post94316

thchuong
Sep 12, 2014, 3:50 AM
Thank you Daniil. It's now working. You can close the topic.