[CLOSED] Icons not appearing in Razor

  1. #1

    [CLOSED] Icons not appearing in Razor

    Hello, i am trying to add buttons to a Top Bar in a Grid Panel. my Code is below:
    Html.X().GridPanel().Layout(LayoutType.Fit)
        .ButtonAlign(Alignment.Left)
        .TopBar(Html.X().Toolbar().Items(
            Html.X().Button()
                .Text("Add")
                .Width(100)
                .Icon(Icon.Add)
                ,
            Html.X().Button()
                .Text("Delete")
                .Width(100)
                .Icon(Icon.Delete)
                
        ))
    When the page is registered no icons are visable next to the buttons. i have tried to register the icons with the MVCResourceManager using the following code with no success.

    Ext.Net.MVC.MvcResourceManager.RegisterGlobalIcon(Icon.Accept);
    Additionally i have tried just adding a button with no GridPanel just to check and it too did no include any icons
    @(Html.X().Button().Text("test").Icon(Icon.Delete))
    how can i make the icons appear in these buttons?

    Thanks,

    Click image for larger version. 

Name:	noIcons.jpg 
Views:	589 
Size:	3.2 KB 
ID:	5589
    Last edited by geoffrey.mcgill; Feb 12, 2013 at 3:23 AM. Reason: [CLOSED]
  2. #2
    Icons works fine for me, for example see the following online sample
    http://mvc.ext.net/#/Models/Data_Annotations/

    Did you register Ext.Net http handler in web.config? Also check resource requests in Fiddler or browser console (requests to ext.axd)
  3. #3
    Hello!

    I couldn't reproduce your problem Click image for larger version. 

Name:	icons1.JPG 
Views:	489 
Size:	10.5 KB 
ID:	5591

    But can you check your image requests in FireBug or in Chrome Developers Tools. You should have something like this: Click image for larger version. 

Name:	icons2.JPG 
Views:	501 
Size:	17.7 KB 
ID:	5592
  4. #4

    image Request

    Quote Originally Posted by Baidaly View Post
    Hello!

    I couldn't reproduce your problem Click image for larger version. 

Name:	icons1.JPG 
Views:	489 
Size:	10.5 KB 
ID:	5591

    But can you check your image requests in FireBug or in Chrome Developers Tools. You should have something like this: Click image for larger version. 

Name:	icons2.JPG 
Views:	501 
Size:	17.7 KB 
ID:	5592
    i have the same line in chrome,
    Click image for larger version. 

Name:	bgImage.jpg 
Views:	535 
Size:	13.8 KB 
ID:	5593
  5. #5
    Quote Originally Posted by alscg View Post
    i have the same line in chrome,
    Click image for larger version. 

Name:	bgImage.jpg 
Views:	535 
Size:	13.8 KB 
ID:	5593
    I have also run fiddler and it is giving me 404 errors for several different sprites and Images
    Click image for larger version. 

Name:	404_errors.jpg 
Views:	552 
Size:	19.2 KB 
ID:	5594
  6. #6
    Please show your web.config and Global.asax (please do not forget to remove any private sensitive information)
  7. #7
    Quote Originally Posted by Vladimir View Post
    Please show your web.config and Global.asax (please do not forget to remove any private sensitive information)


    here is the Global.asax code
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Http;
    using System.Web.Mvc;
    using System.Web.Optimization;
    using System.Web.Routing;
    
    namespace PriceRightHTML5
    {
        // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
        // visit http://go.microsoft.com/?LinkId=9394801
    
        public class MvcApplication : System.Web.HttpApplication
        {
            protected void Application_AuthenticateRequest(object sender, System.EventArgs e)
            {
                string url = HttpContext.Current.Request.FilePath;
    
                // Skip all ext.axd embedded resources
                if (url.EndsWith("ext.axd"))
                {
                    HttpContext.Current.SkipAuthorization = true;
                }
            }
    
            protected void Application_Start()
            {
                AreaRegistration.RegisterAllAreas();
    
                WebApiConfig.Register(GlobalConfiguration.Configuration);
                FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                RouteConfig.RegisterRoutes(RouteTable.Routes);
                BundleConfig.RegisterBundles(BundleTable.Bundles);
            }
        }
    }
    and the Web.Config code:

    <?xml version="1.0" encoding="utf-8"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=152368
      -->
    <configuration>
      <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        <section name="extnet" type="Ext.Net.GlobalConfig" requirePermission="false" />
      </configSections>
    
      <appSettings>
        <add key="webpages:Version" value="2.0.0.0" />
        <add key="webpages:Enabled" value="false" />
        <add key="PreserveLoginUrl" value="true" />
        <add key="ClientValidationEnabled" value="true" />
        <add key="UnobtrusiveJavaScriptEnabled" value="true" />
      </appSettings>
      <system.web>
        <httpRuntime targetFramework="4.5" />
        <compilation debug="true" targetFramework="4.5" />
        <authentication mode="Forms">
          <forms loginUrl="~/Account/Login" 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.Optimization" />
            <add namespace="System.Web.Routing" />
            <add namespace="System.Web.WebPages" />
            <add namespace="Ext.Net"/>
            <add namespace="Ext.Net.MVC"/>
          </namespaces>
          <controls>
            <add assembly="Ext.Net" namespace="Ext.Net" tagPrefix="ext" />
          </controls>
        </pages>
        <profile defaultProvider="DefaultProfileProvider">
          <providers>
            <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
          </providers>
        </profile>
        <membership defaultProvider="DefaultMembershipProvider">
          <providers>
            <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
          </providers>
        </membership>
        <roleManager defaultProvider="DefaultRoleProvider">
          <providers>
            <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
          </providers>
        </roleManager>
        <!--
                If you are deploying to a cloud environment that has multiple web server instances,
                you should change session state mode from "InProc" to "Custom". In addition,
                change the connection string named "DefaultConnection" to connect to an instance
                of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.
          -->
        <sessionState mode="InProc" customProvider="DefaultSessionProvider">
          <providers>
            <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
          </providers>
        </sessionState>
        <httpHandlers>
          <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />
        </httpHandlers>
        <httpModules>
          <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" />
        </httpModules>
      </system.web>
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <handlers>
          <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
          <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
          <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
          <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
          <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
          <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    
          <add name="DirectRequestHandler" verb="*" path="*/ext.axd" preCondition="integratedMode" type="Ext.Net.ResourceHandler, Ext.Net"/>
    
        </handlers>
        <modules>
          <add name="DirectRequestModule" preCondition="managedHandler" type="Ext.Net.DirectRequestModule, Ext.Net" />
        </modules>
      </system.webServer>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
            <bindingRedirect oldVersion="1.0.0.0-4.5.9" newVersion="4.5.10" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Ext.Net.Utilities" publicKeyToken="2c34ac34702a3c23" />
            <bindingRedirect oldVersion="0.0.0.0-2.0.1" newVersion="2.2.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Transformer.NET" publicKeyToken="e274d618e7c603a7" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-2.1.1.22883" newVersion="2.1.1.22883" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
      </entityFramework>
      <extnet theme="Gray" cleanResourceUrl="false" />
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="BasicHttpBinding_AdminService"  maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
            <binding name="AuthenticationCustomEndpoint" />
          </basicHttpBinding>
          <customBinding>
            <binding name="CustomBinding_ReportService">
              <binaryMessageEncoding />
              <httpTransport />
            </binding>
          </customBinding>
        </bindings>
        <client>
          <endpoint address="http://localhost:55522/WebService/ReportService.svc"
              binding="customBinding" bindingConfiguration="CustomBinding_ReportService"
              contract="ReportService.ReportService" name="CustomBinding_ReportService" />
          <endpoint address="http://localhost:55522/WebService/LoginService.svc"
              binding="basicHttpBinding" bindingConfiguration="AuthenticationCustomEndpoint"
              contract="LoginService.LoginService" name="AuthenticationCustomEndpoint" />
          <endpoint address="http://localhost:55522/WebService/AdminService.svc"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_AdminService"
                    contract="AdminService.AdminService" name="BasicHttpBinding_AdminService" />
        </client>
      </system.serviceModel>
    </configuration>
    additionally here is my web.config from the Views folder:
    <?xml version="1.0"?>
    
    <configuration>
      <configSections>
        <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
          <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.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=4.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.Optimization"/>
            <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="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
          <add path="*/ext.axd" verb="*" type="Ext.Net.ResourceHandler" validate="false" />
        </httpHandlers>
        <httpModules>
          <add name="DirectRequestModule" type="Ext.Net.DirectRequestModule, Ext.Net" />
        </httpModules>
        <pages
            validateRequest="false"
            pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
            pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
            userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <controls>
            <add assembly="System.Web.Mvc, Version=4.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>
  8. #8
    You have to register the following IgnoreRoute rule
    routes.IgnoreRoute("{exclude}/{extnet}/ext.axd");
  9. #9
    Quote Originally Posted by Vladimir View Post
    You have to register the following IgnoreRoute rule
    routes.IgnoreRoute("{exclude}/{extnet}/ext.axd");

    that worked great.

    Thanks

Similar Threads

  1. Trouble with icons using razor and mvc 4
    By gdog_5021 in forum 2.x Help
    Replies: 0
    Last Post: Oct 18, 2012, 12:18 AM
  2. [CLOSED] [RAZOR] Vertical scrollbars not appearing
    By gets_gui in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 02, 2012, 11:36 AM
  3. [CLOSED] Icons don't show [Razor]
    By boris in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Apr 25, 2012, 2:38 PM
  4. IFrame appearing above all of components
    By rbarr in forum 1.x Help
    Replies: 0
    Last Post: Apr 11, 2011, 9:10 AM
  5. Replies: 0
    Last Post: Apr 03, 2009, 5:47 AM

Tags for this Thread

Posting Permissions