Modification of UserControl usage to allow for Virtual Path to be used correctly.

This commit is contained in:
Casey Neehouse
2012-11-29 21:27:42 +05:00
parent 76fb5d260f
commit 9eea46b19b
7 changed files with 42 additions and 22 deletions

View File

@@ -60,6 +60,13 @@ namespace umbraco.editorControls.userControlGrapper
{
base.OnInit (e);
if (!_usercontrolPath.StartsWith("~"))
{
if (_usercontrolPath.StartsWith("/"))
_usercontrolPath = "~" + _usercontrolPath;
else
_usercontrolPath = "~/" + _usercontrolPath;
}
Control oControl = new System.Web.UI.UserControl().LoadControl(_usercontrolPath);
if (HasSettings(oControl.GetType()))

View File

@@ -42,7 +42,7 @@ namespace umbraco.editorControls.userControlGrapper
public override string DataTypeName
{
get { return "umbraco usercontrol wrapper"; }
get { return "Umbraco Usercontrol Wrapper"; }
}
public override umbraco.interfaces.IDataPrevalue PrevalueEditor

View File

@@ -76,14 +76,15 @@ namespace umbraco.editorControls.userControlGrapper
private void populateUserControls(string path)
{
DirectoryInfo di = new DirectoryInfo(path);
foreach (FileInfo uc in di.GetFiles("*.ascx"))
{
string root = IOHelper.MapPath(SystemDirectories.Root);
string ucRoot = IOHelper.MapPath(SystemDirectories.Usercontrols);
_dropdownlistUserControl.Items.Add(
new ListItem(
uc.FullName.Substring(root.Length).Replace(IOHelper.DirSepChar, '/'))
new ListItem( SystemDirectories.Usercontrols +
uc.FullName.Substring(ucRoot.Length).Replace(IOHelper.DirSepChar, '/'))
/*
new ListItem(