More in this section

Forums / Developing with Sitefinity / Custom Control not found

Custom Control not found

9 posts, 0 answered
  1. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    01 Dec 2011
    Link to this post
    - I created a UserControl .ascx in a folder UserControls
    - Uploaded the a.ascx and a.ascx.cs files to the server
    - went to sf admin and added the toolbox file
    - build the app and uploaded the SitefinityWebApp.dll
    - created a test page

    I can see my contol on my specified toolbox section, but when I drag the contol on the page I get an error 'The file '/UserControls/a.ascx' does not exist..

    Any idea what I am doing wrong? Yes I think I tripple checked if the file is on the server.

    Markus
  2. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    02 Dec 2011
    Link to this post
    You did put a tilde before the path setting? ~/UserControls/a.acsx ? If so you wouldnt be able to provide some screenshots eh? :)
  3. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    02 Dec 2011
    Link to this post
    Dear Steve
    Thanks in your interest.
    Here are the screenshots.

    Markus
  4. SteveV
    SteveV avatar
    178 posts
    Registered:
    06 Nov 2011
    02 Dec 2011
    Link to this post
    The step I always forget when I create a user control in making the control layout template (.ascx) an embedded resource.  In VS; right click the .ascx>Properties>Build Action>Embedded Resource.

    HTH--Steve
  5. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    02 Dec 2011
    Link to this post
    Hey Steve, Steve here :)

    Actually in his case he has an actual usercontrol, not just a view, so it should be set to:
    ascx: Content
    aspx.cs: Compile
    aspx.designer.cs: Compile

    ...which is default so it probably is?  (can you validate that markus?)

    This is a line from a control in one of my toolboxes...perhaps it needs the layout field?
    <add enabled="True" type="~/UserControls/CME/OnTheRoadCalendar/OnTheRoadCalendar.ascx" title="OnTheRoadCalendar" description="OnTheRoadCalendar" cssClass="ontheroadIcon" layoutTemplate="~/UserControls/CME/OnTheRoadCalendar/OnTheRoadCalendar.ascx" visibilityMode="None" name="OnTheRoadCalendar" />


    (Man this scrollbar is annoying)
  6. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    02 Dec 2011
    Link to this post
    Dear Steve
    Thanks again

    a) yes its set to content, compile compile as you expected
    b) here comes the funny part though.
    If I untick the enable I will not see the contol in the widgets box. If I tick enable I will see it - So far so good.
    Here comes the strange part (maybe) I downloaded the ToolboxesConfig.config file and there is nothing in there!
    I see my other control but not the new one.

    So here are the questions.
    1) when adding a toolbox item like I did. Would/should the app_data/sitefinity/configuration/ToolboxesConfiguration.config be updated
    2) If no - what's that file for
    3) If yes - why is the new control not in it but is showing up in widets anyhow.

    Just to let you know. I added the line manually. Build solution. Uploaded SitefinityWebApp.dll and web.config again. ->Did not make any difference.

    To make sure I made another .ascx and build first, uploaded .dll and then the .ascx and added it in settings.
    This time a simple Hello World. I thought it could be a missleading error.
    Same

    Fiddler shows an 500 /Sitefinity/Services/Pages/ZoneEditorService.svc/Control/ error

    {"CommandName":"new","ErrorMessage":"","PlaceholderId":"content_t_m","ControlType":"~/UserControls/test.ascx","LayoutTemlpate":"","Title":"Test","Description":"Test","ClassId":"","Ordinal":1,"DockId":"RadDockClone_1322838961040","Parameters":[],"Attributes":[],"AddSubmit":null,"FormSubmitType":null,"reloadKey":null,"LayoutControlDataID":null,"PreviousPlaceholderID":null,"PageId":"17086282-b9dd-47ac-a2e4-d3bdee7b7160","PageNodeId":"82e43c10-6f99-4bf9-b807-eee78cf55ba0","Url":"/diverse-seiten/test_zum_loeschen/Action/Edit/de","MediaType":0}

    One more thing the action delete does not remove the widget from the page.
    Markus
  7. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    02 Dec 2011
    Link to this post
    Stupid question. Any of you having a 1885 project laying around and can try a quick hello world .ascx  test.

    Markus
  8. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    02 Dec 2011
    Link to this post
    I have two live 1885 sites with UserControls :/
  9. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    02 Dec 2011
    Link to this post
    I am sure wondering what I could be doing wrong.

    I guess I have to open a ticket. Thanks for all the help and time invested.

    According to this page: http://www.sitefinity.com/40/help/developers-guide/sitefinity-essentials-controls-adding-controls-to-the-toolbox.html I would expect the ToolbopxesConfiguration.config to be updated automatically when adding a toolbox item.

    So the question would be why is it not doing it.

    Markus
9 posts, 0 answered