Try Now
More in this section

Forums / Developing with Sitefinity / What is the easiest way to build/test a Sitefinity user control?

What is the easiest way to build/test a Sitefinity user control?

3 posts, 0 answered
  1. Dan Sorensen
    Dan Sorensen avatar
    256 posts
    13 Aug 2010
    01 Sep 2011
    Link to this post
    Because of how cumbersome it is to...

    1. build a user control into the Sitefinity project,
    2. login,
    3. register it with the Sitefinity back end advanced toolbox,
    4. add my custom control to a page,
    5. and navigate to that page...
    6. Only then to see my obvious coding error,

    ...I feel like I'm developing my Sitefinty control the wrong way.

    How should I be developing a Sitefinity aware user control? Is there a recommended or simpler way to build a control and test it? i.e. is there a simplified Sitefinity database / fluent API compatible project I could use to build/test before integrating the control into the full blown Sitefinity project? Something where I can simply 'press play' and see my work in a developer environment without all the steps.

    Tell me that the guys at Telerik don't go through all those steps for each new user control.

    Thoughts? Recommendations?
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    18 Jul 2012
    01 Sep 2011
    Link to this post
    I can't speak for the telerik developers, but I can share my experience.

    I would certainly not say that you are doing anything "wrong". However, If you are building a widget that is based on a User Control (.ascx file) I would suggest that you build and test it first with a standard asp.net web form page.

    You should still be able instantiate a content manager or use the Fluent API as long as you import the appropriate namespaces. This will allow you to test the front-end functionality on a page without having to register it inside Sitefinity.

    Once I get it working well enough then I'll move on and install it using the toolbox.

    You will however need to use the widget inside sitefinity if you wish to test things like the widget control editor or anything that needs a live sitefinity context (such as retrieving a content item via the Url, etc.).

    If you do need the full context of Sitefinity you could also save a step by registering the widget in the toolbox using the config file (check the "Maually adding/managing controls through configurations" section at bottom of that page).

    I hope this is helpful!
  3. Dan Sorensen
    Dan Sorensen avatar
    256 posts
    13 Aug 2010
    07 Sep 2011
    Link to this post
    I'm finding it easiest to:

    1. Register my user control into the toolbox.
    2. Create a demo page.
    3. Copy my control into the page and save it.
    4. Then bookmark this demo page, both the editor and the preview URLs.

    Then when you run your Sitefinity project, it is easier to get back to the page that tests your control. No need to navigate through the backend pages to your target page.

    Not ideal, but already saving me some time.

    I tried to create a separate project for my user control, but if I needed to interact with the Sitefinity database, there was quite a lot of setup to include all the right Sitefinity references and configuration.

3 posts, 0 answered