当前位置: 首页>>代码示例>>C#>>正文


C# UserControl.LoadControl方法代码示例

本文整理汇总了C#中System.Web.UI.UserControl.LoadControl方法的典型用法代码示例。如果您正苦于以下问题:C# UserControl.LoadControl方法的具体用法?C# UserControl.LoadControl怎么用?C# UserControl.LoadControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.UserControl的用法示例。


在下文中一共展示了UserControl.LoadControl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadControlFromVirtualPath

 /// <summary>
 /// Load a webforms view (Page, UserControl, MasterPage) from the given virtual path.
 /// </summary>
 /// <param name="virtualPath"></param>
 /// <returns></returns>
 public static Control LoadControlFromVirtualPath(string virtualPath)
 {
     // We're using LoadControl of an arbitrary UserControl to load the view. We could also use the BuildManager, but
     // in that case, the control hierarchy appears to be empty and thus, pretty useless.
     UserControl controlLoader = new UserControl();
     return controlLoader.LoadControl(virtualPath);
 }
开发者ID:xwyangjshb,项目名称:cuyahoga,代码行数:12,代码来源:ViewUtil.cs

示例2: OnInit

		bool UserControl { get { return !string.IsNullOrEmpty(Path); } } // we must load a UserControl

		protected override void OnInit(EventArgs e) {
			try {
				if (UserControl) {
					var userControl = new UserControl();
					LoadedControl = userControl.LoadControl(Path);
				}
			} catch { }
			base.OnInit(e);
		}
开发者ID:simonegli8,项目名称:Silversite,代码行数:11,代码来源:EditableContent.cs

示例3: AddComponent

        /// <summary>
        /// Adds the component to dealer product group.
        /// </summary>
        /// <param name="componentPath">The component path.</param>
        /// <param name="targetControlName">Name of the target control.</param>
        /*private void AddComponentToDealerProductGroup(string componentPath, string targetControlName)
        {
          if (!string.Equals(Sitecore.Context.GetSiteName(), "dealer") || !Sitecore.Context.Item.IsItemOfType(Consts.ProducGroupTemplateId))
          {
        return;
          }

          this.AddComponent(componentPath, targetControlName);
        }*/
        /// <summary>
        /// Adds the component cart to product on dealer site.
        /// </summary>
        /// <param name="componentPath">The component path.</param>
        /// <param name="targetControlName">Name of the target control.</param>
        /*private void AddComponentToDealerProduct(string componentPath, string targetControlName)
        {
          if (!string.Equals(Sitecore.Context.GetSiteName(), "dealer") || !Sitecore.Context.Item.IsItemOfType(Consts.ProducBaseTemplateId))
          {
        return;
          }

          this.AddComponent(componentPath, targetControlName);
        }*/
        /// <summary>
        /// Adds the component.
        /// </summary>
        /// <param name="componentPath">The component path.</param>
        /// <param name="targetControlName">Name of the target control.</param>
        private void AddComponent(string componentPath, string targetControlName)
        {
            var rightColumn = this.GetControl(this.Page, targetControlName);
              if (rightColumn == null)
              {
            return;
              }

              var temp = new UserControl();
              var ctrl = temp.LoadControl(componentPath);
              Assert.IsNotNull(ctrl, string.Format("Failed to load control '{0}'", componentPath));
              rightColumn.Controls.AddAt(0, ctrl);
        }
开发者ID:mujtahid,项目名称:sitecore-mobile-sdk,代码行数:46,代码来源:Nicam.aspx.cs


注:本文中的System.Web.UI.UserControl.LoadControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。