File Path for in Extention Project

  1. #1

    File Path for in Extention Project

    I have a VB project: Coolite.Ext.UX - based off of the example found in the Coolite Toolkit. It compiles correctly but I get a JS error Object Expected when adding the 1 extension in the project to a aspx page. When I debug the WebResource file is created but it is empty. I believe that the js file is not getting found.

    The css file is Coolite.Ext.Ux -> Extensions/MyPluginPanel/resources/css/mypluginpanel.css
    The js file is Coolite.Ext.Ux -> Extensions/MyPluginPanel/resources/mypluginpanel.js
    The vb file is Coolite.Ext.Ux -> Extensions/MyPluginPanel/mypluginpanel.vb

    code for mypluginpanel.vb

    Imports System.ComponentModel
    Imports System.Web.UI
    Imports System.Drawing
    Imports Coolite.Ext.Web
    
    <Assembly: WebResource("Coolite.Ext.UX.Extensions.MyPluginPanel.resources.MyPluginPanel.js", "text/javascript")> 
    <Assembly: WebResource("Coolite.Ext.UX.Extensions.MyPluginPanel.resources.MyPluginPanel.css", "text/css")> 
    
    <Designer(GetType(EmptyDesigner))> _
    <DefaultProperty("")> _
    <Xtype("mypluginpanel")> _
    <InstanceOf(ClassName:="Ext.grid.MyPluginPanel")> _
    <ClientScript(Type:=GetType(MyPluginPanel), WebResource:="Coolite.Ext.UX.Extensions.MyPluginPanel.resources.MyPluginPanel.js")> _
    <ClientStyle(Type:=GetType(MyPluginPanel), WebResource:="Coolite.Ext.UX.Extensions.MyPluginPanel.resources.MyPluginPanel.css")> _
    <ToolboxData("<{0}:mypluginpanel runat=""server"" ></{0}:mypluginpanel>")> _
    <Description("Testing a plugin Grid Panel")> _
    Public Class MyPluginPanel    
        Inherits Coolite.Ext.Web.GridPanel
    
        Private Sub MyPluginPanel_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
        End Sub
    End Class
    I believe I have to add FilePath:= in the ClientStyle and ClientScript attribute but I can not figure out what it should be. If do have <Assembly: TagPrefix("Coolite.Ext.UX", "ux")> set it the AssemblyInfo.vb

    Someone did something very similar with lockinggridpanel and I have modeled after that one also. The only difference I can see is the project name (Coolite.UX) and the folder structure.

    Some FilePath variations I have tried with no luck:

    /Extensions/MyPluginPanel/MyPluginPanel.js
    Extensions/MyPluginPanel/MyPluginPanel.js
    ../Extensions/MyPluginPanel/MyPluginPanel.js
    ~/Extensions/MyPluginPanel/MyPluginPanel.js
    ux/Extensions/MyPluginPanel/MyPluginPanel.js
    Coolite/Ext/UX/Extensions/MyPluginPanel/MyPluginPanel.js

    /Coolite/Ext/UX/Extensions/MyPluginPanel/MyPluginPanel.js

    I've also tried using Fiddler to see if it could help narrow it down and no luck with that either.

    Thanks~




  2. #2

    RE: File Path for in Extention Project

    I have verified it's a FilePath issue, when I add the script directly in the aspx everything works as expected. I am looking at the Coolite Toolkit Community edition available for download. In Coolite.Ext.UX there is an extension for GMapPanel. Very Cool.

    Here is the client script attribute located in the GMapPanel.cs

        [ClientScript(Type = typeof(GMapPanel), WebResource = "Coolite.Ext.UX.Extensions.GMapPanel.resources.GMapPanel.js", FilePath = "ux/extensions/gmappanel/gmappanel.js")]
    Things to note:

    - the GmapPanel.js is actually located in Coolite.Ext.UX/Extensions/GMapPanel/resources/GMapPanel.js
    - there is no ux folder

    So I'm guessing that ux is what is defined in the assemblyinfo.cs (I also have defined in my Coolite.Ext.UX)

    [assembly: TagPrefix("Coolite.Ext.UX", "ux")]
    but I can not figure out how the GMapPanel.js is being found when the FilePath isn't the actual folder structure.

    I have taken the GMapPanel and converted from C# to vb.net and followed the exact same folder structure as shown in the example. The only difference is that I am currently working on coolite vs: 0.8.1.987. I still can not get it work. I also found in the changelog examples of the Generic Plugin and how to fill in the filepath (virtual, relative, absolute &amp; app root). It doesn't seem to matter what I do.

    The js file is marked as an embedded resource. There has to be something really simple I am missing. Anyone???
  3. #3

    RE: File Path for in Extention Project

    Hi bsnezw,

    Your code appears correct.


    I can offer the following suggestions.


    Triple check that the files have been marked as Embedded Resources.

    In Visual Studio, perform the following steps:
    1. In the Solution Explorer, Right-Click on File and select Properties
    2. Under the "Build Action" menu option, select "Embedded Resource"


    Once the file is marked as an Embedded Resource, you also need to ensure you've added to the WebResource [assembly:] reference. These are requirements of the .Net Framework and not the Toolkit.


    [assembly: WebResource("Your.Assembly.Path.To.File.js", "text/javascript")]

    You should also be able to view the Html Source (View > Source) for the Page after it's rendered in the browser. The component should output a <script> tag pointing to your file.


    Hope this helps.


    Geoffrey McGill
    Founder
  4. #4

    RE: File Path for in Extention Project

    Victory!

    If anyone else has this problem use .Net Reflector to disassemble the dll and check out the resources. It shows what the assembled embedded resource is. My folder structure is:

    Coolite.Ext.UX/Extensions/GMapPanel/resources/GMapPanel.js

    but when looking at it in .Net Reflector it showed as

    Coolite.Ext.UX.GMapPanel.js

    I changed the assembly and client script to:

    
    <Assembly: WebResource("Coolite.Ext.UX.GMapPanel.js", "text/javascript")> 
    
    <ClientScript(Type:=GetType(GMapPanel), WebResource:="Coolite.Ext.UX.GMapPanel.js")> _
    and it worked! No FilePath required.

    Please mark this as Solved.

Similar Threads

  1. Replies: 0
    Last Post: May 10, 2012, 1:33 AM
  2. Replies: 6
    Last Post: Jan 11, 2012, 9:52 AM
  3. Replies: 0
    Last Post: Nov 04, 2010, 7:09 PM
  4. Replies: 16
    Last Post: May 30, 2010, 1:13 AM
  5. Download file in MVC project
    By danni in forum 1.x Help
    Replies: 0
    Last Post: Aug 10, 2009, 7:50 AM

Posting Permissions