Copied to clipboard

Flag this post as spam?

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


  • TheArtist 22 posts 71 karma points
    Nov 10, 2011 @ 13:34
    TheArtist
    0

    Help with usercontrol in asp.net

    Dear Forum ;)

    First I am new to umbraco and just made a simple new site with my first working usercontrol.

    I want to make a usercontrol in asp.net with a textstring and a button that can be viewed by administrators and not by users can this be done?

    Good tutorials is needed too.... :)

    Thanks and best regards
    Jakob

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Nov 10, 2011 @ 14:05
    Tom Fulton
    0

    Hi Jakob,

    Is this usercontrol a for a datatype, dashboard, or is it to be displayed on the front-end?

    If it's a Dashboard control, you should be able to restrict it in the /config/Dashboard.config file - check out the existing entries and the <access> node which you can use to deny certain roles.

    If it's a datatype, you can't really restrict the datatype from "loading", but in your usercontrol code you can do something to make it invisible or render differently for different users by adding something like this in your Page_Load event:

                if (!umbraco.BusinessLogic.User.GetCurrent().IsAdmin())
                {
                    // do something different for non-admins
                    // hide a panel?
                    pnlWhatever.Visisble = false;
                }

    You could also check out something like the Axendo Disabled Properties package to disable certain properties by roles.  Hope this helps...let us know the details if you need more assistance :)

    For general info on usercontrol datatypes:  http://www.nibble.be/?p=24  http://www.nibble.be/?p=97  http://umbraco.com/help-and-support/video-tutorials/developing-with-umbraco/data-editors/creating-a-custom-datatype-using-the-usercontrol-wrapper/TVPlayer

    -Tom

  • TheArtist 22 posts 71 karma points
    Nov 10, 2011 @ 23:08
    TheArtist
    0

    Hello Tom

    Thank you for your reply it worked like a sharm :)

    Thanks, Jakob

Please Sign in or register to post replies

Write your reply to:

Draft