Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Sørensen 304 posts 650 karma points
    Apr 09, 2009 @ 00:38
    Paul Sørensen
    0

    Developing using VS2008


    Hi

    I'm want to make some usercontrols for mu Umbraco site. I downloaded the source code version and fired it up in VS2008, but it does not run the installer, so I don't get the database content created.

    Do I need to do something specific ?
    - or do you use a different approach to develop umbraco usercontrols ?

    Thanks
    Paul S

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 09, 2009 @ 09:21
    Dirk De Grave
    0

    Hi,

    Here's what I usually do when developing for an umbraco site:

    Download either an official release (v4.0.0/v4.0.1) or the latest changeset.

    If downloading an official release, just go and install that one according to the documentation which can be found on http://umbraco.org/documentation/books (Look for the install section)

    If using a changeset, open up the solution for the version you'd like to use. Build the complete solution. If solution build, copy the complete content of presentation folder into the folder for the umbraco installation. From there on, follow the tutorial on installing umbraco.

    For own development of user controls, fire up vs.net again and create a new web project. Add the relevant user controls and start coding and building. Add a post build event that will copy:

    - Dll's to the /bin folder of the umbraco installation
    - user controls to the /usercontrols folder of the umb installation

    From there on, use macro's, templates and the like to get the user controls in your umbraco site.

    Great thing about this setup is you get to debug user controls or umbraco quite easily. Just attach a debugger to the asp_net worker process (w3wp.exe in vista) and start debugging whenever something's not working as expected.

    Good luck,

    Regards,
    /Dirk


  • Paul Sørensen 304 posts 650 karma points
    Apr 09, 2009 @ 10:58
    Paul Sørensen
    0

    Thanks Dirk.

    It sounds as if it's

    1) code in your own web project,
    2) copy the the release installation of Umbraco
    3) Run - and debug there.
    4) go back to your own project again and make changes and correct errors and go back to 2) again

    I would like to access umbraco business logic in my own project. I'm trying to make a calendar control so I need to access event nodes created.

    I supposed I have to copy some of the umbraco dll's to my bin folder and make my connection string point to my umbraco database.

    Paul S

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 09, 2009 @ 11:15
    Dirk De Grave
    0

    Yup,

    For dll references, I usually reference dll's from the /bin folder of the umbraco install.
    Don't have to create new connection strings, as all this info becomes available if you reference the correct dll's.

    If you wish to work with umbraco documents, there's no need to create/change a connection string. Even if you're using custom tables alongside the umbraco standard tables.

    For example, next code snippet adds a record to a custom table:

    [code]ISqlHelper helper = DataLayerHelper.CreateSqlHelper(GlobalSettings.DbDSN);

    helper.ExecuteNonQuery("INSERT INTO TABLE(Id) VALUES (@Id)",
    helper.CreateParameter("@Id", 1));[/code]

    Hope this helps.

    Regards,
    /Dirk

  • Paul Sørensen 304 posts 650 karma points
    Apr 10, 2009 @ 15:05
    Paul Sørensen
    0


    Copy the dll's to the bin folder - ok
    - user controls to the /usercontrols folder of the umb installation - ?

    Whats the umb installation in this case ?

    The ascx file in my project refers to the cs file. The make it refer to the dll I normally do a 'Publish website'

    Regards
    Paul S

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Apr 10, 2009 @ 15:35
    Richard Soeteman
    0

    Hi,

    What Dirk means with umb installation is the folder where you've installed Umbraco in. Regarding the .cs file you have two options 1 make it a dll and store the dll in the /bin folder or just put the .cs file along with you usercontrol. I prefer the first option.

    Hope it helps you,

    Cheers,

    Richard

  • Paul Sørensen 304 posts 650 karma points
    Apr 10, 2009 @ 22:11
    Paul Sørensen
    0

    Hi

    How do you register it as a macro then when theres no ascx file ?
    I tried registering it as a Custom control but gets nothing displayed on my page - it does not sound correct either.

    Regards Paul S

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 12, 2009 @ 12:20
    Dirk De Grave
    0

    Hi,

    [quote]How do you register it as a macro then when theres no ascx file ?[/quote]
    You don't! Macro's are supposed to work with either xslt files or ascx files (user controls).
    If you have built a custom control, you'll have to wrap it in a user control!

    Hope this helps.

    Regards,
    /Dirk

  • Paul Sørensen 304 posts 650 karma points
    Apr 12, 2009 @ 13:54
    Paul Sørensen
    0

    Hi Dirk
    Thanks for trying to help.
    I just have to have this cleared out. I have a usercontrol which I compile into a dll. I registrered it as a custom control - which I believe is wrong. I added it to a page and started up my umbraco site. I then attached my debugger to the aspnet_wp process and I see my code being executed - I can step through it. I just don't see the controls displayed on my page - I do however see the output of a Resonse.Write.

    Is it because my approach with the usercontrol compiled into a dll does not work for umbraco ?
    - or is it because I'm not registrering it correct

    Thanks
    Paul S

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 12, 2009 @ 17:36
    Dirk De Grave
    0

    Hi,

    Don't see what it's meant by registering it as a custom control? Just need to have the user control copied to the usercontrols dir, dll goes into bin folder and create a new macro that references the user control. Nothing else is required? If you can attach/debug and step through using vs.net, then the user control gets hit, just not sure why it doesn't display! Don't know at this point what the user control is supposed to do of course! Any hints on that?

    Regards,
    /Dirk

  • Paul Sørensen 304 posts 650 karma points
    Apr 12, 2009 @ 18:09
    Paul Sørensen
    0

    Hi
    By registrering I mean creating a new macro and because my usercontrol is compiled into one dll - the ascx file too - I see my only option is to use the Custom conrol option.

    I think the idea about compiling it all into one dll is not to exposed the ascx file - that's why in this case I don't have an ascx file.

    I sounds as if I can't used the 'Compile the usecontrol into a dll' option

    Regards
    Paul S

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Apr 12, 2009 @ 21:02
    Dirk De Grave
    0

    Hi,

    Ascx file (user control) has to go to the user control directory. Assembly into /bin directory.
    If ascx file has not been copied to the /usercontrols dir, no macro referencing that user control can be created.

    Regards,
    /Dirk

  • Paul Sørensen 304 posts 650 karma points
    Apr 12, 2009 @ 23:09
    Paul Sørensen
    0

    Thanks Dirk
    That's also what I ended up realizing - thanks for clarifying.

    Regards
    Paul S

Please Sign in or register to post replies

Write your reply to:

Draft