PDA

View Full Version : [CLOSED] Icons don't show [Razor]



boris
Apr 25, 2012, 10:08 AM
In my projet icons don't show in Razor code.

For example:


...
.Buttons(buttons =>
{
buttons.Add(Html.X().Button().ID("ButtonSave").Text(Resources.R.Sacuvaj).Icon(Icon.DatabaseSave ));
})

This is for all icons except when use javascript code where icons showing:


Ext.MessageBox.show({ title: '@Resources.R.UN', msg: '@Resources.R.UNO', buttons: Ext.Msg.OK, icon: Ext.MessageBox.WARNING, width: 250 });

In project solutinon I added Ext.Net (source project) as separate project. I don't use only dll-s.

Do I need any reference to icons?

Daniil
Apr 25, 2012, 10:42 AM
Hi,

I was unable to reproduce the problem using the example below.

Example

@{ Layout = ""; }

<!DOCTYPE html>

<html>
<head>
<title>Ext.NET v2 Example</title>
</head>
<body>
@Html.X().ResourceManager()
@Html.X().Button().Icon(Icon.DatabaseSave)
</body>
</html>

Please provide a full example. I will check it's reproducible with the latest sources or not.

Or update from SVN and re-test. If the issue persists, please provide a sample.

boris
Apr 25, 2012, 12:43 PM
Update from svn not helps.

Here is full test example:

View:


@{
Layout = "";
ViewBag.Title = "Index";
}

<h2>Index</h2>

@Html.X().ResourceManager()

@(Html.X().Button().Text("tekst").Icon(Icon.Accept))

Controller:


public class TestController : System.Web.Mvc.Controller
{
//
// GET: /Test/

public ActionResult Index()
{
return View();
}

}


Web.config in Views folder:


<?xml version="1.0"?>

<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSe ctionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSectio n, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPages Section, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>

<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="Ext.Net" />
<add namespace="Ext.Net.MVC" />
</namespaces>
</pages>
</system.web.webPages.razor>

<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>

<system.web>
<httpHandlers>
<add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false"/>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>



<!--
Enabling request validation in view pages would cause validation to occur
after the input has already been processed by the controller. By default
MVC performs request validation before a controller processes the input.
To change this behavior apply the ValidateInputAttribute to a
controller or action.
-->
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />

<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
</configuration>


Web.config in web project:


<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->

<configuration>
<appSettings>
<add key="webpages:Version" value="1.0.0.0"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>

<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>


</compilation>

<httpModules>
<add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net"/>
</httpModules>

<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>

<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages"/>
</namespaces>
</pages>
</system.web>

<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>


Global.asax:


namespace TestIcons
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801

public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}

protected void Application_AuthenticateRequest(object sender, System.EventArgs e)
{
string url = HttpContext.Current.Request.FilePath;

if (url.EndsWith("ext.axd"))
{
HttpContext.Current.SkipAuthorization = true;
}
}

public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{exclude}/{extnet}/ext.axd");

routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

}

protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();

RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
}
}

boris
Apr 25, 2012, 12:47 PM
Also I try in test example to use onlly dll references to Ext.Net, Transformer.NET, Newtonsoft.Json. Result is the same: no icons.

Daniil
Apr 25, 2012, 1:33 PM
What link did you update Ext.NET?

It should be:
http://svn.ext.net/premium/branches/2.0

Also, I think, you should add

<httpHandlers>
<add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false"/>
</httpHandlers>
for the Web.config of the project.

boris
Apr 25, 2012, 2:16 PM
Yes, that tag must be in project web.config. Thanks!

I use http://svn.ext.net/premium for download but when download I get project from folder branches/2.0/Ext.Net. I think that is the same as yours address. Is it?

Daniil
Apr 25, 2012, 2:30 PM
I use http://svn.ext.net/premium for download but when download I get project from folder branches/2.0/Ext.Net. I think that is the same as yours address. Is it?

Well, the the "branches/2.0" folder is the sub-folder of the "svn.ext.net/premium" one.

Generally, if you are getting the sources from the "branches/2.0", it's correct.

boris
Apr 25, 2012, 2:38 PM
Yes, I am getting source from that branches/2.0 folder.
Thanks.