How to Load UserControls from different folder rather than from "~\UserControls"

Apr 21, 2008 at 2:41 PM

Is there a way to load usercontrols from different folder rather than from "~\UserControls" ?
May be from "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES".
Apr 23, 2008 at 2:44 PM
Edited Apr 23, 2008 at 2:44 PM
It's hard coded in the SmartPart. Just alter line 35 of SmartPart.cs : private string _userControlPath = "/UserControls";
Apr 23, 2008 at 3:16 PM
Edited Apr 23, 2008 at 3:23 PM
I last I tried somthing like this was using the beta version using a dwp export file.

You may or may not need what I wanted to accomplish but, my criteria was:
No dropdown list so a user could not change the smart part
No export button so a user could not share this web part, it would need to be requested
Organize the web parts into categories

1. Create your web part in test - meaning I used a test box with ReturnoftheSmartPart beta 1.2.
2. before exporting the dwp - make sure to set all properties (toolpane) to desired export settings Note: Unless coded otherwise they will export. Idea - I did for IT department preset everything that I thought should be done. Only affects dwp file.
3. Export the web part dwp file
4. Change the vb code to include export off " 'wp.ExportMode = WebPartExportMode.None "
5. Copy file to hidden folder in live - if not already done on live "E:\Inetpub\wwwroot\UserControls\" + "Global" or "ITOnly"
6. Change export dwp file add showusercontrollist false add: "<ShowUserControlList xmlns="SmartPart">false</ShowUserControlList>"
7. Change export dwp file add the path to hidden folder name. Search for "UserControls" add: "\Global"
<UserControl xmlns="SmartPart">~\/UserControls\Global\ISChangeRequest.ascx</UserControl>
<UserControlPath xmlns="SmartPart">/UserControls/Global</UserControlPath>
8. Log on as admin or desinger to the site of your choice.
9. Site Actions - site settings - Galleries - Web Parts - Upload - Browse (to the dwp file) - then click "OK"
10. Change The Description
"View Call Request Information. This is initially setup for IT. But can be adjusted for any group."
11.Group - Specify your own Value:
"Information Technology Web Parts"
12. click OK
13. go back to home page and add the web part
14. save the dwp file into? or delete?

Directions I emailed out to users:
To add the web part:
1. In upper right hand corner Click “Welcome your name”
2. Click “Personalize this page”. - making sure you are in personal view.
3. Click “Add web part”. – this will depend on which column you want the web part to display
4. Scroll down to "All Web Parts"
5. Click the check box for the web part you want under the group "Information Technology Group Web Parts"
6. Click the "Add" Button
7. Upper right hand corner Click "Exit Edit Mode"


I hope this is what you may have wanted. I guess that I view this as somewhat secure, someone would have to be able to administrate the web parts - thus have access to them.
Chris :)